我有一个简单的entrypoint
类,只加载一个面板
public class TestUI implements EntryPoint
{
PanelA panelA = new PanelA();
public void onModuleLoad()
{
final RootPanel rootPanel = RootPanel.get();
rootPanel.add( panelA );
}
}
这是面板B
public class PanelB extends HTMLPanel
{
public PanelB()
{
super("Panel B");
final PanelA panelA = new PanelA();
Button btnNewButton = new Button("Go to panel A");
btnNewButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final RootPanel rootPanel = RootPanel.get();
rootPanel.clear();
rootPanel.add( panelA );
}
});
add(btnNewButton);
}
}
这是面板A
public class PanelA extends HTMLPanel
{
public PanelA( )
{
super("Panel A");
final PanelB panelB = new PanelB();
Button btnNewButton = new Button("Go to panel B");
btnNewButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final RootPanel rootPanel = RootPanel.get();
rootPanel.clear();
rootPanel.add( panelB );
}
});
add(btnNewButton);
}
}
但是,当我尝试加载包含此入口点的页面时,它会失败并出现下面的异常跟踪。如果我将入口点中对面板 A 的引用替换为纯 HTML 面板,则它可以正常加载。我的简单面板有什么问题?我基本上是在尝试创建一个 GUI,我可以在其中在页面之间来回单击,我认为这将是实现该目标的第一步。
Exception in thread "Code server for stockwatcher from Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 com.google.gwt.dev.shell.BrowserChannel$RemoteDeathError: Remote connection lost
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:536)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at java.io.DataOutputStream.flush(Unknown Source)
at com.google.gwt.dev.shell.BrowserChannel$ReturnMessage.send(BrowserChannel.java:1310)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:533)
... 2 more