JMenuItem getItem() { JMenuItem i; if (null == cmd) { i = new JMenu(name); for (MenuElement e : submenu) { i.add(e.getItem()); } } else { i = new JMenuItem(cmd.name()); i.setActionCommand(cmd.name()); i.addActionListener(menuListener); } return i; }
public void processCommand(MenuCmds cmd) { System.out.println("Command: " + cmd.name()); }