我如何将MouseEvents添加到AbsolutePanel? [英] How do I add MouseEvents to an AbsolutePanel?

查看:142
本文介绍了我如何将MouseEvents添加到AbsolutePanel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将MouseEvents,特别是MouseOutHandlers添加到AbsolutePanel而不创建Composite窗口小部件?或者这可能吗?从我可以告诉它涉及添加DomHandler和HandlerRegistration。

考虑到我是一个新的GWT和Java,一个详细的例子将不胜感激。



p>

Eric

解决方案

您必须创建自定义的AbsolutePanel。按照代码。我认为这应该工作。现在你可以添加鼠标出处理程序到绝对面板。如果你想使用所有的鼠标事件实现HasAllMouseHandlers并实现所有的方法。

  public class MyAbsolutePanel extends AbsolutePanel implements HasMouseOutHandlers {
$ b $ public HandlerRegistration addMouseOutHandler(MouseOutHandler handler){
return addDomHandler(handler,MouseOutEvent.getType()) ;
}

}


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

解决方案

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());  
     }  

  }

这篇关于我如何将MouseEvents添加到AbsolutePanel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆