如何在vaadin中动态添加标签?

发布于 2024-08-23 05:46:53 字数 114 浏览 2 评论 0原文

我想知道如何在 vaadin 选项卡中动态添加选项卡。我有 TabSheet,它由两个选项卡组成。第一个选项卡有一个按钮。如果我们单击该按钮,则另一个选项卡应该在选项卡中动态添加。任何人都可以告诉我如何实现这一点。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恬淡成诗 2024-08-30 05:46:53

请在此处查看演示、代码示例和 API 文档。

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

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);
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文