我有一個簡單entrypoint
類,只是加載面板異常裝載簡單的GWT視圖
public class TestUI implements EntryPoint
{
PanelA panelA = new PanelA();
public void onModuleLoad()
{
final RootPanel rootPanel = RootPanel.get();
rootPanel.add(panelA);
}
}
這裏是PanelB
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);
}
}
然而,當我嘗試加載包含此入口點的頁面,並在下面的異常跟蹤中失敗。 如果我用純HTML面板替換入口點中Panel A的引用,那麼它會正常加載。我的簡單面板有什麼問題? 我基本上試圖創建一個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
是的,就是這樣,現在排序,乾杯 – MayoMan