【发布时间】:2018-06-10 05:30:00
【问题描述】:
我有一个应用程序,它使用来自 ArrayList (listOne) 的输入来创建组件条目。
在某一时刻,我想用第二个 ArrayList(listTwo,实际上是对 listOne 的修改)中的元素重新填充侧边菜单。
我的问题是两个列表中的项目都出现在侧面菜单中。
如何刷新侧边菜单,让它只显示新列表的项目?
我们将不胜感激。
这是我目前所拥有的:
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);
}
}
【问题讨论】:
-
不建议使用
tb.remove()或tb.removeAll()之类的东西,因为您正在入侵我们内部的工具栏实现。
标签: codenameone side-menu