tags:

views:

245

answers:

1

Hi,

I want to know how to add tab dynamically in vaadin tabsheet. I am having TabSheet which consists of two tabs. First tab has one button.If we click that button then another tab should add dynamically in the tabsheet.Can anyone tell me how to achieve this.

+3  A: 

Check out the demos, code samples, and API docs 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);
    }
}
Daniel