@JavaBean(defaultProperty="UIClassID", description="An item which can be selected in a menu.") @SwingContainer(false) @SuppressWarnings({"serial"})
public class JMenuItem
  Comment     Returned-by     Constructor-argument     Method-argument     Field-type     Type-bound     Links  

An implementation of an item in a menu. A menu item is essentially a button sitting in a list. When the user selects the "button", the action associated with the menu item is performed. A JMenuItem contained in a JPopupMenu performs exactly that function.

Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For further documentation and for examples, see How to Use Menus in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see java.beans.XMLEncoder.

extends AbstractButton implements Accessible, MenuElement

See also:
JPopupMenu, JMenu, JCheckBoxMenuItem, JRadioButtonMenuItem

Since:  1.2