开发者

Empty page when put TabLayoutPanel to SplitLayoutPanel

开发者 https://www.devze.com 2023-03-31 06:25 出处:网络
I have a GWT code, but the result is empty page. why? public void onModuleLoad() { leftPanelSetup(); rightPanelSetup();

I have a GWT code, but the result is empty page. why?

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);

 开发者_如何学Python   //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);
}


Add the SplitLayoutpanel to RootLayoutPanel, instead of RootPanel


layoutPanel.setSize("500px", "400px"); fixs it. because by default div's size = 0

0

精彩评论

暂无评论...
验证码 换一张
取 消