1 /*
2 * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
33 import java.util.Enumeration;
34 import java.util.EventListener;
35 import java.util.Vector;
36
37 import javax.accessibility.Accessible;
38 import javax.accessibility.AccessibleContext;
39 import javax.accessibility.AccessibleRole;
40
41 import sun.awt.AWTAccessor;
42
43 /**
44 * The {@code MenuBar} class encapsulates the platform's
45 * concept of a menu bar bound to a frame. In order to associate
46 * the menu bar with a {@code Frame} object, call the
47 * frame's {@code setMenuBar} method.
48 * <p>
49 * <a id="mbexample"></a><!-- target for cross references -->
50 * This is what a menu bar might look like:
51 * <p>
52 * <img src="doc-files/MenuBar-1.gif"
53 * alt="Diagram of MenuBar containing 2 menus: Examples and Options.
54 * Examples menu is expanded showing items: Basic, Simple, Check, and More Examples."
55 * style="float:center; margin: 7px 10px;">
56 * <p>
57 * A menu bar handles keyboard shortcuts for menu items, passing them
58 * along to its child menus.
59 * (Keyboard shortcuts, which are optional, provide the user with
60 * an alternative to the mouse for invoking a menu item and the
61 * action that is associated with it.)
62 * Each menu item can maintain an instance of {@code MenuShortcut}.
63 * The {@code MenuBar} class defines several methods,
64 * {@link MenuBar#shortcuts} and
65 * {@link MenuBar#getShortcutMenuItem}
66 * that retrieve information about the shortcuts a given
67 * menu bar is managing.
68 *
69 * @author Sami Shaio
70 * @see java.awt.Frame
71 * @see java.awt.Frame#setMenuBar(java.awt.MenuBar)
72 * @see java.awt.Menu
73 * @see java.awt.MenuItem
74 * @see java.awt.MenuShortcut
75 * @since 1.0
|
1 /*
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
33 import java.util.Enumeration;
34 import java.util.EventListener;
35 import java.util.Vector;
36
37 import javax.accessibility.Accessible;
38 import javax.accessibility.AccessibleContext;
39 import javax.accessibility.AccessibleRole;
40
41 import sun.awt.AWTAccessor;
42
43 /**
44 * The {@code MenuBar} class encapsulates the platform's
45 * concept of a menu bar bound to a frame. In order to associate
46 * the menu bar with a {@code Frame} object, call the
47 * frame's {@code setMenuBar} method.
48 * <p>
49 * <a id="mbexample"></a><!-- target for cross references -->
50 * This is what a menu bar might look like:
51 * <p>
52 * <img src="doc-files/MenuBar-1.gif"
53 * alt="Diagram of MenuBar containing 2 menus: Examples and Options. Examples
54 * menu is expanded showing items: Basic, Simple, Check, and More Examples."
55 * style="margin: 7px 10px;">
56 * <p>
57 * A menu bar handles keyboard shortcuts for menu items, passing them
58 * along to its child menus.
59 * (Keyboard shortcuts, which are optional, provide the user with
60 * an alternative to the mouse for invoking a menu item and the
61 * action that is associated with it.)
62 * Each menu item can maintain an instance of {@code MenuShortcut}.
63 * The {@code MenuBar} class defines several methods,
64 * {@link MenuBar#shortcuts} and
65 * {@link MenuBar#getShortcutMenuItem}
66 * that retrieve information about the shortcuts a given
67 * menu bar is managing.
68 *
69 * @author Sami Shaio
70 * @see java.awt.Frame
71 * @see java.awt.Frame#setMenuBar(java.awt.MenuBar)
72 * @see java.awt.Menu
73 * @see java.awt.MenuItem
74 * @see java.awt.MenuShortcut
75 * @since 1.0
|