menuBar = new MenuBar();
for (Object menu : root.elements("menu")) menuBar.addMenu(buildMenu((Element) menu));
}
protected Menu buildMenu(Element element) {
Menu m = null;
if (element != null) {
m = new Menu();
m.setKey(element.attributeValue("menukey"));
List<MenuItem> items = new ArrayList<MenuItem>();
for (Object item : element.elements("menuitem")) items.add(buildMenuItem((Element) item));
m.setAction(getAction(element));
if (items.size() > 0) m.setItems(items);
}
return m;
}