如何在vaadin中动态添加Tabs?

时间:2010-02-26 11:51:40

标签: java user-interface vaadin

我想知道如何在vaadin标签页中动态添加标签。我有TabSheet,它包含两个选项卡。第一个选项卡有一个按钮。如果我们点击该按钮,那么另一个选项卡应该在标签页中动态添加。任何人都可以告诉我如何实现这一点。

1 个答案:

答案 0 :(得分:5)

查看演示,代码示例和API文档here

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);
    }
}
相关问题