开发者

html body gwt click event

html file 开发者_开发百科has two textbox and one button. but i need to generate click event when i only click outside of the two textboxes and button element.how can i do that.

RootPanel.get().addEventListener or something like that?? help.


Typing anywhere in the browser window will trigger alert pop-up:

Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
  @Override
  public void onPreviewNativeEvent(NativePreviewEvent event) {
    NativeEvent ne = event.getNativeEvent();
    if (KeyDownEvent.getType().getName().equals(ne.getType())) {
      Window.alert("who fired me last?"
          + event.getNativeEvent().getCurrentEventTarget()
          + "\nevent target:" + event.getNativeEvent().getEventTarget());
    }
  }
});


I don't know, if RootPanel.get().addEventListener works, but you can add another panel, which contains the three elements. To the new panel you can add an listener.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜