我有带标签的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);
但是怎么做?
答案 0 :(得分: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);
答案 1 :(得分: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"));