我没有用过swt,刚才看了一下api 你看下面这个方法行不行。 Abutton的 on action do 里面调用Bbutton的notifyListeners方法。 notifyListeners org.eclipse.swt.widgets Class Widget public void notifyListeners(int eventType, Event event) Notifies all of the receiver's listeners for events of the given type that one such event has occurred by invoking their handleEvent() method. The event type is one of the event constants defined in class SWT. Parameters: eventType - the type of event which has occurred event - the event data Throws: SWTException - * ERROR_WIDGET_DISPOSED - if the receiver has been disposed * ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver 我觉得应该可以的。
有A、B2个按钮 对应的事件为A.action(XXX)、B.action(XXX)
如果点击A 却像执行A、B 2个的事件 那就把B的事件放到A的事件里就可以了。。
改为A.action(XXX;B.action())
你看下面这个方法行不行。
Abutton的
on action do 里面调用Bbutton的notifyListeners方法。
notifyListeners
org.eclipse.swt.widgets
Class Widget
public void notifyListeners(int eventType,
Event event)
Notifies all of the receiver's listeners for events of the given type that one such event has occurred by invoking their handleEvent() method. The event type is one of the event constants defined in class SWT.
Parameters:
eventType - the type of event which has occurred
event - the event data
Throws:
SWTException -
* ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
我觉得应该可以的。
如果你描述的问题,只是想触发button的click事件的话,notify这套方法就够了
不过,我觉得notify的话,和你直接调用方法,其实没什么大区别关键是你到底遇到了什么问题
你上面说嵌入了js,你是怎么嵌入的
另:在swt中也是可以使用awt Robot的
js的问题我已经解决了 用api的一个方法 现在的问题就是 《如何触发button的click事件》