本文介绍了GWT 1.7中的FlexTable的鼠标悬停侦听器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在GWT 1.7中添加事件监听器或处理程序到小部件?
How do you add an event listener or handler to widgets in GWT 1.7?
我知道有一些关于这个问题的问题,但是它似乎已经过时了。
例如(忽略在CSS中有一个:hover)的事实,例如,如何将一个Hover监听器添加到FlexTable?
I know there are some questions alreayd about this on SO but it seems they are outdated.For example (ignoring the fact that there is a :hover in CSS) how do I add a Hover listener to a FlexTable for example?
推荐答案
如果要将MouseOverHandler添加到FlexTable,请尝试以下方式:
If you want to add a MouseOverHandler to a FlexTable try this:
public class MyFlexTable extends FlexTable implements MouseOverHandler, HasMouseOverHandler {
public MyFlexTable() {
this.addMouseOverHandler(this);
}
public void onMouseOver(MouseOverEvent event) {
//do something
}
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
return addDomHandler(handler, MouseOverEvent.getType());
}
}
这篇关于GWT 1.7中的FlexTable的鼠标悬停侦听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!