2010-02-26 41 views
1

我想知道如何在vaadin标签页中动态添加选项卡。我有TabSheet由两个选项卡组成。第一个选项卡有一个按钮。如果我们单击该按钮,则另一个选项卡应该在选项卡中动态添加。可以告诉我如何实现此目的。如何在vaadin中动态添加选项卡?

回答

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); 
    } 
}