Adding a MouseOverHandler to an Element?

前端 未结 4 2052
悲&欢浪女
悲&欢浪女 2021-02-08 18:14

I would like to listen for the mouse over event in GWT 1.6. Since GWT 1.6 has introduced handlers and deprecated listeners I\'m unsure as to how I can accomplish this with what

4条回答
  •  悲哀的现实
    2021-02-08 18:56

    If you know the type of the object some widgets include a static wrap function. From one of them I was able to derive the following class.

    public class Widget extends com.google.gwt.user.client.ui.Widget
    {
        public Widget(Element element, boolean detatchFromDom)
        {
            super();
            if (detatchFromDom)
                element.removeFromParent();
    
            setElement(element);
    
            if (!detatchFromDom)
            {
                onAttach();
                RootPanel.detachOnWindowClose(this);
            }
        }
    
        public  HandlerRegistration addDomHandlerPub(final H handler, DomEvent.Type type)
        {
            return addDomHandler(handler, type);
        }
    }
    

提交回复
热议问题