Creating A New Clickable Object

5 views
Skip to first unread message

nickgr...@gmail.com

unread,
Aug 15, 2006, 1:12:37 PM8/15/06
to Google Web Toolkit
I'm trying to make a clickable panel class by subclassing the
PopupPanel and implementing the SourcesClickEvents, however, I can't
seem to figure out how to get basic functionality. I'm sure I'm missing
something like registering my class with some overhead class that
handles input, but can anyone help? Here's my little class:

public class ClickablePanel extends PopupPanel implements
SourcesClickEvents {
private ClickListenerCollection listeners = new
ClickListenerCollection();

public ClickablePanel() {
super( false );
}

public void onBrowserEvent( Event event ) {
if ( DOM.eventGetType(event) == Event.ONCLICK )
{
listeners.fireClick( this );
}
}

public void addClickListener( ClickListener listener )
{
listeners.addElement( listener );
}

public void removeClickListener( ClickListener listener )
{
listeners.removeElement( listener );
}
}

Mat Gessel

unread,
Aug 15, 2006, 1:20:59 PM8/15/06
to Google-We...@googlegroups.com
It is as you say. You need to call sinkEvents(Event.ONCLICK) in the
constructor.

-= Mat

--
Mat Gessel
http://www.asquare.net

Reply all
Reply to author
Forward
0 new messages