1

我想知道如何在 vaadin tabsheet 中动态添加选项卡。我有由两个选项卡组成的 TabSheet。第一个选项卡有一个按钮。如果我们单击该按钮,则另一个选项卡应在选项卡表中动态添加。谁能告诉我如何实现这一点。

4

1 回答 1

5

在此处查看演示、代码示例和 API 文档。

final TabSheet tabSheet = new TabSheet();

Button button = new Button("Add the tab");
button.addListener(new Button.ClickListener(){
    public void buttonClick(ClickEvent event) {
        VerticalLayout content = new VerticalLayout();
        content.addComponent(new Label("This is the tab content."));
        Tab tab = tabSheet.addTab(content, "The new Tab", null);
    }
}
于 2010-02-26T12:15:07.077 回答