我在 gwt 应用程序中创建了两个模块名称 module1 和 module2。我想在几秒钟后同时将消息从模块 1 传递到模块 2 和模块 2 到模块 1。我编写了以下代码,但它给了我错误,无法在类路径中找到 module1.gwt.xml。
public void onModuleLoad() {
mainBus.fireEvent(new PingEvent("-----Simulation Started-----"));
}
module1
public void onModuleLoad()
{
GWTEventBus.mainBus.addHandler(PingEvent.TYPE, new PingEventHandler(){
public void onEvent(PingEvent event) {
System.out.print("Inside Ping --> ");
new Timer(){
public void run() {
GWTEventBus.mainBus.fireEvent(new PongEvent("Pong fired..."));
}
}.schedule(1000);
}
});
}
module2
public void onModuleLoad()
{
//final SimpleEventBus mainBus = new SimpleEventBus();
GWTEventBus.mainBus.addHandler(PongEvent.TYPE, new PongEventHandler(){
public void onEvent(PongEvent event) {
System.out.print("Inside Pong1 --> ");
new Timer(){
public void run() {
GWTEventBus.mainBus.fireEvent(new PingEvent("Ping fired..."));
}
}.schedule(1000);
}
});
}
plz help me.