I tried this code:
public class OwnFlowPanel开发者_StackOverflow社区 extends FlowPanel implements HasClickHandlers{
public HandlerRegistration addClickHandler(ClickHandler handler) {
return addDomHandler(handler, ClickEvent.getType());
}
}
and then I used this in another class:
OwnFlowPanel panel = new OwnFlowPanel();
panel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.alert("Clicked on object id: "+id);
}
});
This didn't work :(
Nevermind! I restarted Eclipse's server and it works now :-P
You could also just put the FlowPanel
into a FocusPanel
(call setWidget()
).
精彩评论