< prev index next >
src/java.desktop/share/classes/java/awt/MenuBar.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -20,20 +20,25 @@
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package java.awt;
+import java.awt.event.KeyEvent;
+import java.awt.peer.MenuBarPeer;
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.util.Vector;
import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
import sun.awt.AWTAccessor;
-import java.awt.peer.MenuBarPeer;
-import java.awt.event.KeyEvent;
-import javax.accessibility.*;
/**
* The {@code MenuBar} class encapsulates the platform's
* concept of a menu bar bound to a frame. In order to associate
* the menu bar with a {@code Frame} object, call the
@@ -92,11 +97,11 @@
* actual menus that will be part of the MenuBar.
*
* @serial
* @see #countMenus()
*/
- Vector<Menu> menus = new Vector<>();
+ private final Vector<Menu> menus = new Vector<>();
/**
* This menu is a special menu dedicated to
* help. The one thing to note about this menu
* is that on some platforms it appears at the
@@ -104,11 +109,11 @@
*
* @serial
* @see #getHelpMenu()
* @see #setHelpMenu(Menu)
*/
- Menu helpMenu;
+ private volatile Menu helpMenu;
private static final String base = "menubar";
private static int nameCounter = 0;
/*
@@ -250,12 +255,12 @@
menus.removeElementAt(index);
MenuBarPeer peer = (MenuBarPeer)this.peer;
if (peer != null) {
peer.delMenu(index);
m.removeNotify();
- m.parent = null;
}
+ m.parent = null;
if (helpMenu == m) {
helpMenu = null;
m.isHelpMenu = false;
}
}
< prev index next >