本文介绍了org.eclipse.swt.widgets.Button从代码中单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从代码中单击Button。我想要做以下事情:
I am trying to click Button from code. I am tying to do the following:
class MyMouseAdapter extends MouseAdapter
{
public void mouseDown(MouseEvent evt)
{
System.out.println("Working!!!!");
}
}
Button button = new Button();
button.addMouseListener(new MyMouseAdapter());
现在我想从代码中运行mouseDown方法你能告诉我怎么做吗?
now I want to run the mouseDown method from code could you tell me how to do it?
谢谢。
推荐答案
你可以这样做:
button.notifyListeners( SWT.MouseDown, null );
其中 null
是事件
。请记住,这是听众收到的事件
。
Where null
is an Event
. Remember that this is the Event
received by your listener.
这篇关于org.eclipse.swt.widgets.Button从代码中单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!