예제 #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());
 }