src/share/classes/javax/swing/JMenuItem.java

Print this page




  37 import java.io.ObjectInputStream;
  38 import java.io.IOException;
  39 
  40 import javax.swing.plaf.*;
  41 import javax.swing.plaf.basic.*;
  42 import javax.swing.event.*;
  43 import javax.accessibility.*;
  44 
  45 /**
  46  * An implementation of an item in a menu. A menu item is essentially a button
  47  * sitting in a list. When the user selects the "button", the action
  48  * associated with the menu item is performed. A <code>JMenuItem</code>
  49  * contained in a <code>JPopupMenu</code> performs exactly that function.
  50  * <p>
  51  * Menu items can be configured, and to some degree controlled, by
  52  * <code><a href="Action.html">Action</a></code>s.  Using an
  53  * <code>Action</code> with a menu item has many benefits beyond directly
  54  * configuring a menu item.  Refer to <a href="Action.html#buttonActions">
  55  * Swing Components Supporting <code>Action</code></a> for more
  56  * details, and you can find more information in <a
  57  * href="http://java.sun.com/docs/books/tutorial/uiswing/misc/action.html">How
  58  * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
  59  * <p>
  60  * For further documentation and for examples, see
  61  * <a
  62  href="http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html">How to Use Menus</a>
  63  * in <em>The Java Tutorial.</em>
  64  * <p>
  65  * <strong>Warning:</strong> Swing is not thread safe. For more
  66  * information see <a
  67  * href="package-summary.html#threading">Swing's Threading
  68  * Policy</a>.
  69  * <p>
  70  * <strong>Warning:</strong>
  71  * Serialized objects of this class will not be compatible with
  72  * future Swing releases. The current serialization support is
  73  * appropriate for short term storage or RMI between applications running
  74  * the same version of Swing.  As of 1.4, support for long term storage
  75  * of all JavaBeans<sup><font size="-2">TM</font></sup>
  76  * has been added to the <code>java.beans</code> package.
  77  * Please see {@link java.beans.XMLEncoder}.
  78  *
  79  * @beaninfo
  80  *   attribute: isContainer false
  81  * description: An item which can be selected in a menu.
  82  *




  37 import java.io.ObjectInputStream;
  38 import java.io.IOException;
  39 
  40 import javax.swing.plaf.*;
  41 import javax.swing.plaf.basic.*;
  42 import javax.swing.event.*;
  43 import javax.accessibility.*;
  44 
  45 /**
  46  * An implementation of an item in a menu. A menu item is essentially a button
  47  * sitting in a list. When the user selects the "button", the action
  48  * associated with the menu item is performed. A <code>JMenuItem</code>
  49  * contained in a <code>JPopupMenu</code> performs exactly that function.
  50  * <p>
  51  * Menu items can be configured, and to some degree controlled, by
  52  * <code><a href="Action.html">Action</a></code>s.  Using an
  53  * <code>Action</code> with a menu item has many benefits beyond directly
  54  * configuring a menu item.  Refer to <a href="Action.html#buttonActions">
  55  * Swing Components Supporting <code>Action</code></a> for more
  56  * details, and you can find more information in <a
  57  * href="http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
  58  * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
  59  * <p>
  60  * For further documentation and for examples, see
  61  * <a
  62  href="http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html">How to Use Menus</a>
  63  * in <em>The Java Tutorial.</em>
  64  * <p>
  65  * <strong>Warning:</strong> Swing is not thread safe. For more
  66  * information see <a
  67  * href="package-summary.html#threading">Swing's Threading
  68  * Policy</a>.
  69  * <p>
  70  * <strong>Warning:</strong>
  71  * Serialized objects of this class will not be compatible with
  72  * future Swing releases. The current serialization support is
  73  * appropriate for short term storage or RMI between applications running
  74  * the same version of Swing.  As of 1.4, support for long term storage
  75  * of all JavaBeans<sup><font size="-2">TM</font></sup>
  76  * has been added to the <code>java.beans</code> package.
  77  * Please see {@link java.beans.XMLEncoder}.
  78  *
  79  * @beaninfo
  80  *   attribute: isContainer false
  81  * description: An item which can be selected in a menu.
  82  *