Пример #1
0
    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;
    }
Пример #2
0
 @Override
 public void actionPerformed(ActionEvent e) {
   processCommand(MenuCmds.valueOf(e.getActionCommand()));
 }
Пример #3
0
 public void processCommand(MenuCmds cmd) {
   System.out.println("Command: " + cmd.name());
 }