48 * An implementation of a menu bar. You add <code>JMenu</code> objects to the
49 * menu bar to construct a menu. When the user selects a <code>JMenu</code>
50 * object, its associated <code>JPopupMenu</code> is displayed, allowing the
51 * user to select one of the <code>JMenuItems</code> on it.
52 * <p>
53 * For information and examples of using menu bars see
54 * <a
55 href="https://docs.oracle.com/javase/tutorial/uiswing/components/menu.html">How to Use Menus</a>,
56 * a section in <em>The Java Tutorial.</em>
57 * <p>
58 * <strong>Warning:</strong> Swing is not thread safe. For more
59 * information see <a
60 * href="package-summary.html#threading">Swing's Threading
61 * Policy</a>.
62 * <p>
63 * <strong>Warning:</strong>
64 * Serialized objects of this class will not be compatible with
65 * future Swing releases. The current serialization support is
66 * appropriate for short term storage or RMI between applications running
67 * the same version of Swing. As of 1.4, support for long term storage
68 * of all JavaBeans™
69 * has been added to the <code>java.beans</code> package.
70 * Please see {@link java.beans.XMLEncoder}.
71 * <p>
72 * <strong>Warning:</strong>
73 * By default, pressing the Tab key does not transfer focus from a <code>
74 * JMenuBar</code> which is added to a container together with other Swing
75 * components, because the <code>focusTraversalKeysEnabled</code> property
76 * of <code>JMenuBar</code> is set to <code>false</code>. To resolve this,
77 * you should call the <code>JMenuBar.setFocusTraversalKeysEnabled(true)</code>
78 * method.
79 *
80 * @author Georges Saab
81 * @author David Karlton
82 * @author Arnaud Weber
83 * @see JMenu
84 * @see JPopupMenu
85 * @see JMenuItem
86 * @since 1.2
87 */
88 @JavaBean(defaultProperty = "UI", description = "A container for holding and displaying menus.")
485 */
486 @BeanProperty(bound = false)
487 public AccessibleContext getAccessibleContext() {
488 if (accessibleContext == null) {
489 accessibleContext = new AccessibleJMenuBar();
490 }
491 return accessibleContext;
492 }
493
494 /**
495 * This class implements accessibility support for the
496 * <code>JMenuBar</code> class. It provides an implementation of the
497 * Java Accessibility API appropriate to menu bar user-interface
498 * elements.
499 * <p>
500 * <strong>Warning:</strong>
501 * Serialized objects of this class will not be compatible with
502 * future Swing releases. The current serialization support is
503 * appropriate for short term storage or RMI between applications running
504 * the same version of Swing. As of 1.4, support for long term storage
505 * of all JavaBeans™
506 * has been added to the <code>java.beans</code> package.
507 * Please see {@link java.beans.XMLEncoder}.
508 */
509 @SuppressWarnings("serial")
510 protected class AccessibleJMenuBar extends AccessibleJComponent
511 implements AccessibleSelection {
512
513 /**
514 * Get the accessible state set of this object.
515 *
516 * @return an instance of AccessibleState containing the current state
517 * of the object
518 */
519 public AccessibleStateSet getAccessibleStateSet() {
520 AccessibleStateSet states = super.getAccessibleStateSet();
521 return states;
522 }
523
524 /**
525 * Get the role of this object.
|
48 * An implementation of a menu bar. You add <code>JMenu</code> objects to the
49 * menu bar to construct a menu. When the user selects a <code>JMenu</code>
50 * object, its associated <code>JPopupMenu</code> is displayed, allowing the
51 * user to select one of the <code>JMenuItems</code> on it.
52 * <p>
53 * For information and examples of using menu bars see
54 * <a
55 href="https://docs.oracle.com/javase/tutorial/uiswing/components/menu.html">How to Use Menus</a>,
56 * a section in <em>The Java Tutorial.</em>
57 * <p>
58 * <strong>Warning:</strong> Swing is not thread safe. For more
59 * information see <a
60 * href="package-summary.html#threading">Swing's Threading
61 * Policy</a>.
62 * <p>
63 * <strong>Warning:</strong>
64 * Serialized objects of this class will not be compatible with
65 * future Swing releases. The current serialization support is
66 * appropriate for short term storage or RMI between applications running
67 * the same version of Swing. As of 1.4, support for long term storage
68 * of all JavaBeans
69 * has been added to the <code>java.beans</code> package.
70 * Please see {@link java.beans.XMLEncoder}.
71 * <p>
72 * <strong>Warning:</strong>
73 * By default, pressing the Tab key does not transfer focus from a <code>
74 * JMenuBar</code> which is added to a container together with other Swing
75 * components, because the <code>focusTraversalKeysEnabled</code> property
76 * of <code>JMenuBar</code> is set to <code>false</code>. To resolve this,
77 * you should call the <code>JMenuBar.setFocusTraversalKeysEnabled(true)</code>
78 * method.
79 *
80 * @author Georges Saab
81 * @author David Karlton
82 * @author Arnaud Weber
83 * @see JMenu
84 * @see JPopupMenu
85 * @see JMenuItem
86 * @since 1.2
87 */
88 @JavaBean(defaultProperty = "UI", description = "A container for holding and displaying menus.")
485 */
486 @BeanProperty(bound = false)
487 public AccessibleContext getAccessibleContext() {
488 if (accessibleContext == null) {
489 accessibleContext = new AccessibleJMenuBar();
490 }
491 return accessibleContext;
492 }
493
494 /**
495 * This class implements accessibility support for the
496 * <code>JMenuBar</code> class. It provides an implementation of the
497 * Java Accessibility API appropriate to menu bar user-interface
498 * elements.
499 * <p>
500 * <strong>Warning:</strong>
501 * Serialized objects of this class will not be compatible with
502 * future Swing releases. The current serialization support is
503 * appropriate for short term storage or RMI between applications running
504 * the same version of Swing. As of 1.4, support for long term storage
505 * of all JavaBeans
506 * has been added to the <code>java.beans</code> package.
507 * Please see {@link java.beans.XMLEncoder}.
508 */
509 @SuppressWarnings("serial")
510 protected class AccessibleJMenuBar extends AccessibleJComponent
511 implements AccessibleSelection {
512
513 /**
514 * Get the accessible state set of this object.
515 *
516 * @return an instance of AccessibleState containing the current state
517 * of the object
518 */
519 public AccessibleStateSet getAccessibleStateSet() {
520 AccessibleStateSet states = super.getAccessibleStateSet();
521 return states;
522 }
523
524 /**
525 * Get the role of this object.
|