How do I add MouseEvents to an AbsolutePanel?

别说谁变了你拦得住时间么 提交于 2019-12-24 01:57:15

问题


How do I add MouseEvents, specifically MouseOutHandlers to an AbsolutePanel without creating a Composite widget? Or is this possible? From what I can tell it involves adding a DomHandler, and a HandlerRegistration.

A detailed example would be greatly appreciated considering I am quite new GWT and Java.

Thanks,

Eric


回答1:


You have to create custom AbsolutePanel. Follow the code.I think this should work.Now you can add mouse out handler to absolute panel.If you want to use all Mouse events implement HasAllMouseHandlers and implement all the methods.

   public class MyAbsolutePanel extends AbsolutePanel implements HasMouseOutHandlers{

    public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {  
       return addDomHandler(handler, MouseOutEvent.getType());  
     }  

  }


来源:https://stackoverflow.com/questions/1512692/how-do-i-add-mouseevents-to-an-absolutepanel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!