gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 08:18:38 24 4
gpt4 key购买 nike

我想知道如何在 vaadin 标签表中动态添加标签。我有包含两个选项卡的 TabSheet。第一个选项卡有一个按钮。如果我们单击该按钮,那么另一个选项卡应该在选项卡表中动态添加。谁能告诉我如何实现这一点。

最佳答案

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

关于java - 如何在vaadin中动态添加标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2341337/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com