开发者

how use an onclick with FlowPanel?

开发者 https://www.devze.com 2023-01-22 18:12 出处:网络
I tried this code: public class OwnFlowPanel开发者_StackOverflow社区 extends FlowPanel implements HasClickHandlers{

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()).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号