我有一个GWT代码,但结果是空页。为什么?
public void onModuleLoad() {
leftPanelSetup();
rightPanelSetup();
splitPanelSetup();
}
private void splitPanelSetup() {
SplitLayoutPanel layoutPanel = new SplitLayoutPanel();
layoutPanel.addWest(leftTabLayoutPanel, 300);
layoutPanel.addEast(rightTabLayoutPanel, 400);
RootPanel.get("content").add(layoutPanel);
}
private void leftPanelSetup() {
// Create a tab panel
leftTabLayoutPanel = new TabLayoutPanel(1.5, Style.Unit.EM);
//leftTabPanel.setWidth("300px");
// 1
VerticalPanel vPanel1 = new VerticalPanel();
leftTabLayoutPanel.add(vPanel1, "Russian");
// 2
VerticalPanel vPanel2 = new VerticalPanel();
leftTabLayoutPanel.add(vPanel2, "English");
// 3
VerticalPanel vPanel3 = new VerticalPanel();
leftTabLayoutPanel.add(vPanel3, "French");
// Make the first tab selected and the tab's content visible
leftTabLayoutPanel.selectTab(0);
//RootPanel.get("content").add(tabPanel);
}
private void rightPanelSetup() {
// Create a tab panel
rightTabLayoutPanel = new TabLayoutPanel(1.5, Style.Unit.EM);
//rightTabPanel.setWidth("400px");
// 1
VerticalPanel vPanel1 = new VerticalPanel();
rightTabLayoutPanel.add(vPanel1, "Russian");
// 2
VerticalPanel vPanel2 = new VerticalPanel();
rightTabLayoutPanel.add(vPanel2, "English");
// 3
VerticalPanel vPanel3 = new VerticalPanel();
rightTabLayoutPanel.add(vPanel3, "French");
// Make the first tab selected and the tab's content visible
rightTabLayoutPanel.selectTab(0);
//RootPanel.get("content").add(tabPanel);
}
答案 0 :(得分:2)
将SplitLayoutpanel
添加到RootLayoutPanel
,而不是RootPanel
答案 1 :(得分:0)
layoutPanel.setSize(“500px”,“400px”);解决它。因为默认情况下div的大小= 0