【问题标题】:How to add Tabs dynamically in vaadin?如何在 vaadin 中动态添加选项卡?
【发布时间】:2011-01-21 10:20:27
【问题描述】:

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

【问题讨论】:

    标签: java user-interface vaadin


    【解决方案1】:

    查看演示、代码示例和 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);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-30
      相关资源
      最近更新 更多