Kumar
Kumar

Reputation: 5469

How to add Tabs dynamically in vaadin?

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.

Upvotes: 1

Views: 3735

Answers (1)

Daniel
Daniel

Reputation: 10235

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

Upvotes: 5

Related Questions