MenuItemInternal (MenuItemInternal parent, Component each) { if (each == null) { return null; } MenuItemInternal result = null; if (each instanceof ActionMenuItem ami) { result = new MenuItemInternal(parent, -1, System.identityHashCode(ami), ami.isToggleable() ? GlobalMenuLib.ITEM_CHECK : GlobalMenuLib.ITEM_SIMPLE, ami.getAnAction()); result.jitem = ami; } else if (each instanceof ActionMenu am2) { result = new MenuItemInternal(parent, -1, System.identityHashCode(am2), GlobalMenuLib.ITEM_SUBMENU, am2.getAnAction()); result.jitem = am2; } else if (each instanceof JSeparator) { result = new MenuItemInternal(parent, -1, System.identityHashCode(each), GlobalMenuLib.ITEM_SIMPLE, null); } else if (each instanceof StubItem) { // System.out.println("skip StubItem"); } else { LOG.error("unknown type of menu-item, class: " + each.getClass()); } return result; }