52 * Swing Components Supporting <code>Action</code></a> for more
53 * details, and you can find more information in <a
54 * href="https://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
55 * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
56 * <p>
57 * For further documentation and for examples, see
58 * <a
59 href="https://docs.oracle.com/javase/tutorial/uiswing/components/menu.html">How to Use Menus</a>
60 * in <em>The Java Tutorial.</em>
61 * <p>
62 * <strong>Warning:</strong> Swing is not thread safe. For more
63 * information see <a
64 * href="package-summary.html#threading">Swing's Threading
65 * Policy</a>.
66 * <p>
67 * <strong>Warning:</strong>
68 * Serialized objects of this class will not be compatible with
69 * future Swing releases. The current serialization support is
70 * appropriate for short term storage or RMI between applications running
71 * the same version of Swing. As of 1.4, support for long term storage
72 * of all JavaBeans™
73 * has been added to the <code>java.beans</code> package.
74 * Please see {@link java.beans.XMLEncoder}.
75 *
76 * @author Georges Saab
77 * @author David Karlton
78 * @see JPopupMenu
79 * @see JMenu
80 * @see JCheckBoxMenuItem
81 * @see JRadioButtonMenuItem
82 * @since 1.2
83 */
84 @JavaBean(defaultProperty = "UIClassID", description = "An item which can be selected in a menu.")
85 @SwingContainer(false)
86 @SuppressWarnings("serial")
87 public class JMenuItem extends AbstractButton implements Accessible,MenuElement {
88
89 /**
90 * @see #getUIClassID
91 * @see #readObject
92 */
802 @BeanProperty(bound = false)
803 public AccessibleContext getAccessibleContext() {
804 if (accessibleContext == null) {
805 accessibleContext = new AccessibleJMenuItem();
806 }
807 return accessibleContext;
808 }
809
810
811 /**
812 * This class implements accessibility support for the
813 * <code>JMenuItem</code> class. It provides an implementation of the
814 * Java Accessibility API appropriate to menu item user-interface
815 * elements.
816 * <p>
817 * <strong>Warning:</strong>
818 * Serialized objects of this class will not be compatible with
819 * future Swing releases. The current serialization support is
820 * appropriate for short term storage or RMI between applications running
821 * the same version of Swing. As of 1.4, support for long term storage
822 * of all JavaBeans™
823 * has been added to the <code>java.beans</code> package.
824 * Please see {@link java.beans.XMLEncoder}.
825 */
826 @SuppressWarnings("serial")
827 protected class AccessibleJMenuItem extends AccessibleAbstractButton implements ChangeListener {
828
829 private boolean isArmed = false;
830 private boolean hasFocus = false;
831 private boolean isPressed = false;
832 private boolean isSelected = false;
833
834 AccessibleJMenuItem() {
835 super();
836 JMenuItem.this.addChangeListener(this);
837 }
838
839 /**
840 * Get the role of this object.
841 *
842 * @return an instance of AccessibleRole describing the role of the
|
52 * Swing Components Supporting <code>Action</code></a> for more
53 * details, and you can find more information in <a
54 * href="https://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
55 * to Use Actions</a>, a section in <em>The Java Tutorial</em>.
56 * <p>
57 * For further documentation and for examples, see
58 * <a
59 href="https://docs.oracle.com/javase/tutorial/uiswing/components/menu.html">How to Use Menus</a>
60 * in <em>The Java Tutorial.</em>
61 * <p>
62 * <strong>Warning:</strong> Swing is not thread safe. For more
63 * information see <a
64 * href="package-summary.html#threading">Swing's Threading
65 * Policy</a>.
66 * <p>
67 * <strong>Warning:</strong>
68 * Serialized objects of this class will not be compatible with
69 * future Swing releases. The current serialization support is
70 * appropriate for short term storage or RMI between applications running
71 * the same version of Swing. As of 1.4, support for long term storage
72 * of all JavaBeans
73 * has been added to the <code>java.beans</code> package.
74 * Please see {@link java.beans.XMLEncoder}.
75 *
76 * @author Georges Saab
77 * @author David Karlton
78 * @see JPopupMenu
79 * @see JMenu
80 * @see JCheckBoxMenuItem
81 * @see JRadioButtonMenuItem
82 * @since 1.2
83 */
84 @JavaBean(defaultProperty = "UIClassID", description = "An item which can be selected in a menu.")
85 @SwingContainer(false)
86 @SuppressWarnings("serial")
87 public class JMenuItem extends AbstractButton implements Accessible,MenuElement {
88
89 /**
90 * @see #getUIClassID
91 * @see #readObject
92 */
802 @BeanProperty(bound = false)
803 public AccessibleContext getAccessibleContext() {
804 if (accessibleContext == null) {
805 accessibleContext = new AccessibleJMenuItem();
806 }
807 return accessibleContext;
808 }
809
810
811 /**
812 * This class implements accessibility support for the
813 * <code>JMenuItem</code> class. It provides an implementation of the
814 * Java Accessibility API appropriate to menu item user-interface
815 * elements.
816 * <p>
817 * <strong>Warning:</strong>
818 * Serialized objects of this class will not be compatible with
819 * future Swing releases. The current serialization support is
820 * appropriate for short term storage or RMI between applications running
821 * the same version of Swing. As of 1.4, support for long term storage
822 * of all JavaBeans
823 * has been added to the <code>java.beans</code> package.
824 * Please see {@link java.beans.XMLEncoder}.
825 */
826 @SuppressWarnings("serial")
827 protected class AccessibleJMenuItem extends AccessibleAbstractButton implements ChangeListener {
828
829 private boolean isArmed = false;
830 private boolean hasFocus = false;
831 private boolean isPressed = false;
832 private boolean isSelected = false;
833
834 AccessibleJMenuItem() {
835 super();
836 JMenuItem.this.addChangeListener(this);
837 }
838
839 /**
840 * Get the role of this object.
841 *
842 * @return an instance of AccessibleRole describing the role of the
|