public final JMenuItem addCheckboxItem(JMenu menu,String key,String label){
  JCheckBoxMenuItem item=new JCheckBoxMenuItem(label);
  menuItems.put(key,item);
  item.setActionCommand(key);
  menu.add(item);
  item.addItemListener(itemListener);
  return item;
}

public final JMenuItem addCheckboxItem ( JMenu menu , String key , String label ) { JCheckBoxMenuItem item = new JCheckBoxMenuItem ( label ) ; menuItems . put ( key , item ) ; item . setActionCommand ( key ) ; menu . add ( item ) ; item . addItemListener ( itemListener ) ; return item ; }
adds a checkboxmenuitem to a menu .
