问题
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