1

我有带有标签的 tabSheet。

 TabSheet tabsheet = new TabSheet();
 tabsheet.setSizeUndefined();
 tabsheet.addTab(new Label("Contents of the first tab"),"Слои");
 tabsheet.addTab(table, "Tab");
 tabsheet.addTab(new Label("Contents of the third tab"),"Межевые планы");

现在我想将另一个组件添加到第二个选项卡,例如 horisontalLayout

  HorizontalLayout lo = new HorizontalLayout();
  Button newContact = new Button();
  Button search = new Button();
  Button share = new Button();
  Button help = new Button();
   lo.addComponent(newContact);
   lo.addComponent(search);
   lo.addComponent(share);
   lo.addComponent(help);

但是如何做到这一点?

4

2 回答 2

4

准备布局:

    VerticalLayout l1 = new VerticalLayout();
    l1.setMargin(true);
    l1.addComponent(new Label("I am a label."));
    ... add your other components here.

然后将其添加到您的标签页:

    TabSheet t = new TabSheet();
    t.setHeight("200px");
    t.setWidth("400px");
    t.addTab(l1, "My Tab", icon1);
于 2012-10-03T07:26:14.667 回答
0

首先,您应该定义整个选项卡的布局,然后您可以在此布局中添加其他组件。请参见下面的示例:

VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSizeFull();
tabsheet.addTab(verticalLayout, "Vertical Layout with inline components");
verticalLayout.addComponent(new Lable("Example"));
verticalLayout.addComponent(new Button("Button"));
于 2012-10-08T07:07:57.493 回答