How do I setup for and/or handle onload event with GWT

前端 未结 1 1745
孤独总比滥情好
孤独总比滥情好 2020-12-30 14:06

This has to be a pretty basic question but I cannot for the life of me find anything via Google or this site about how to do this and it\'s really frustrating because I\'ve

相关标签:
1条回答
  • 2020-12-30 14:29

    Most widgets and panels in GWT implements the HasAttachHandlers interface. Adding an AttachEvent.Handler to these widgets/panels is equivalent to defining a function to run onload.

    An example:

    FlowPanel mainPanel = new FlowPanel();
    mainPanel.addAttachHandler(new AttachEvent.Handler() {
    
      @Override
      public void onAttachOrDetach(AttachEvent event) {
        // do something
      }
    });
    
    0 讨论(0)
提交回复
热议问题