1 /* |
1 /* |
2 * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
20 * |
20 * |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
|
25 |
25 package java.awt; |
26 package java.awt; |
26 |
27 |
|
28 import java.awt.event.KeyEvent; |
|
29 import java.awt.peer.MenuPeer; |
27 import java.io.IOException; |
30 import java.io.IOException; |
28 import java.io.ObjectInputStream; |
31 import java.io.ObjectInputStream; |
|
32 import java.util.Enumeration; |
29 import java.util.Vector; |
33 import java.util.Vector; |
30 import java.util.Enumeration; |
34 |
31 import java.awt.peer.MenuPeer; |
35 import javax.accessibility.Accessible; |
32 import java.awt.event.KeyEvent; |
36 import javax.accessibility.AccessibleContext; |
33 import javax.accessibility.*; |
37 import javax.accessibility.AccessibleRole; |
|
38 |
34 import sun.awt.AWTAccessor; |
39 import sun.awt.AWTAccessor; |
35 |
40 |
36 /** |
41 /** |
37 * A {@code Menu} object is a pull-down menu component |
42 * A {@code Menu} object is a pull-down menu component |
38 * that is deployed from a menu bar. |
43 * that is deployed from a menu bar. |
76 * A vector of the items that will be part of the Menu. |
81 * A vector of the items that will be part of the Menu. |
77 * |
82 * |
78 * @serial |
83 * @serial |
79 * @see #countItems() |
84 * @see #countItems() |
80 */ |
85 */ |
81 Vector<MenuItem> items = new Vector<>(); |
86 private final Vector<MenuItem> items = new Vector<>(); |
82 |
87 |
83 /** |
88 /** |
84 * This field indicates whether the menu has the |
89 * This field indicates whether the menu has the |
85 * tear of property or not. It will be set to |
90 * tear of property or not. It will be set to |
86 * {@code true} if the menu has the tear off |
91 * {@code true} if the menu has the tear off |
90 * it is no longer needed. |
95 * it is no longer needed. |
91 * |
96 * |
92 * @serial |
97 * @serial |
93 * @see #isTearOff() |
98 * @see #isTearOff() |
94 */ |
99 */ |
95 boolean tearOff; |
100 private final boolean tearOff; |
96 |
101 |
97 /** |
102 /** |
98 * This field will be set to {@code true} |
103 * This field will be set to {@code true} |
99 * if the Menu in question is actually a help |
104 * if the Menu in question is actually a help |
100 * menu. Otherwise it will be set to |
105 * menu. Otherwise it will be set to |
101 * {@code false}. |
106 * {@code false}. |
102 * |
107 * |
103 * @serial |
108 * @serial |
104 */ |
109 */ |
105 boolean isHelpMenu; |
110 volatile boolean isHelpMenu; |
106 |
111 |
107 private static final String base = "menu"; |
112 private static final String base = "menu"; |
108 private static int nameCounter = 0; |
113 private static int nameCounter = 0; |
109 |
114 |
110 /* |
115 /* |