gwt splitlayout将小部件插入布局

时间:2014-09-19 15:55:28

标签: gwt layout

我创建了splitlayout并创建了一个新的ListBox。

        ListBox lb = new ListBox();
        lb.addItem("foo");
        lb.addItem("bar");
        lb.addItem("baz");
        lb.addItem("toto");
        lb.addItem("tintin");


        SplitLayoutPanel p = new SplitLayoutPanel();
        p.addWest(new HTML("list"), 128);           
        p.add(new HTML("details"));
        RootLayoutPanel rp = RootLayoutPanel.get();
        rp.add(p);

现在我如何插入' lb'在' p'的西边? 我试过了p.addWest(lb,pixel);'而不是' p.addWest(新的HTML(" list"),128);'它看起来很糟糕!!请帮忙

1 个答案:

答案 0 :(得分:0)

    ListBox lb = new ListBox();
    lb.addItem("foo");
    lb.addItem("bar");
    lb.addItem("baz");
    lb.addItem("toto");
    lb.addItem("tintin");


    SplitLayoutPanel p = new SplitLayoutPanel();
    p.addWest(lb, 100);
    p.addWest(new HTML("list"), 128);           
    p.add(new HTML("details"));
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);

在SplitLayoutPanel / DockLayoutPanel中,添加中心窗口小部件后无法添加窗口小部件,即在使用api splitLayoutPanel.add( Widget w )之后,因此必须先进行所有操作,或者先重新布局整个面板