我有一个应用程序,它使用来自 ArrayList (listOne) 的输入来创建组件条目。
有一次,我想用第二个 ArrayList(listTwo,实际上是对 listOne 的修改)中的元素重新填充 sidemenu。
我的问题是两个列表中的项目都出现在侧面菜单中。
如何刷新侧面菜单,使其仅显示新列表的项目?
任何帮助将不胜感激。
这是我到目前为止所拥有的:
tb = hi.getToolbar();
for (String s : listOne) {
testLabel = new Label(s);
tb.addComponentToSideMenu(testLabel);
}
public void test () {
tb.remove();
tb.removeAll();
tb.removeComponent(testLabel);
testLabel.remove();
for (String string : listTwo) {
testLabel = new Label(string);
tb.addComponentToSideMenu(testLabel);
}
}