[英]Add MenuItem List to Parent Menu Item
I have a MenuItem List 我有一个MenuItem列表
MenuItem restart= schedules.addItem("Restart", null);
MenuItem start= schedules.addItem("start", null);
MenuItem stop= schedules.addItem("stop", null);
List<MenuItem> menuItems = new ArrayList<MenuItem>();
menuItems.add(restart);
menuItems.add(start);
menuItems.add(stop);
Also I have a Parent MenuItem and the schdules is the MenuBar. 另外,我还有一个Parent MenuItem,而时间表是MenuBar。
MenuItem options= schedules.addItem("Restart", null);
My Question is is there any way to add My MenuItem
List( menuItems
) to my Parent MenuItem
( options
) 我的问题是有什么办法可以将我的
MenuItem
List( menuItems
)添加到我的Parent MenuItem
( options
)
I dont know if a understood correctly what you need to do but i will try. 我不知道您是否正确理解了您需要做什么,但我会尽力而为。 You can use a loop in your List menuItems and call setParent(MenuItem parent) on each object, setting the parent there.
您可以在列表menuItems中使用循环,并在每个对象上调用setParent(MenuItem parent),在此设置父对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.