public final JMenuItem addItem(JMenu menu,String key,String label,int mnemonic){
  JMenuItem item=new JMenuItem(label);
  if (mnemonic != -1) {
    item.setMnemonic(mnemonic);
  }
  menuItems.put(key,item);
  item.setActionCommand(key);
  menu.add(item);
  item.addActionListener(actionListener);
  return item;
}

public final JMenuItem addItem ( JMenu menu , String key , String label , int mnemonic ) { JMenuItem item = new JMenuItem ( label ) ; if ( mnemonic != - 1 ) { item . setMnemonic ( mnemonic ) ; } menuItems . put ( key , item ) ; item . setActionCommand ( key ) ; menu . add ( item ) ; item . addActionListener ( actionListener ) ; return item ; }
adds a menuitem to a menu .
