src/share/classes/java/awt/MenuBar.java
Print this page
@@ -79,11 +79,11 @@
new AWTAccessor.MenuBarAccessor() {
public Menu getHelpMenu(MenuBar menuBar) {
return menuBar.helpMenu;
}
- public Vector getMenus(MenuBar menuBar) {
+ public Vector<Menu> getMenus(MenuBar menuBar) {
return menuBar.menus;
}
});
}
@@ -92,11 +92,11 @@
* actual menus that will be part of the MenuBar.
*
* @serial
* @see #countMenus()
*/
- Vector menus = new Vector();
+ 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
@@ -307,11 +307,11 @@
/*
* This is called by the native code, so client code can't
* be called on the toolkit thread.
*/
final Menu getMenuImpl(int i) {
- return (Menu)menus.elementAt(i);
+ return menus.elementAt(i);
}
/**
* Gets an enumeration of all menu shortcuts this menu bar
* is managing.
@@ -319,14 +319,14 @@
* menu bar is managing.
* @see java.awt.MenuShortcut
* @since JDK1.1
*/
public synchronized Enumeration<MenuShortcut> shortcuts() {
- Vector shortcuts = new Vector();
+ Vector<MenuShortcut> shortcuts = new Vector<>();
int nmenus = getMenuCount();
for (int i = 0 ; i < nmenus ; i++) {
- Enumeration e = getMenu(i).shortcuts();
+ Enumeration<MenuShortcut> e = getMenu(i).shortcuts();
while (e.hasMoreElements()) {
shortcuts.addElement(e.nextElement());
}
}
return shortcuts.elements();
@@ -436,11 +436,11 @@
throws ClassNotFoundException, IOException, HeadlessException
{
// HeadlessException will be thrown from MenuComponent's readObject
s.defaultReadObject();
for (int i = 0; i < menus.size(); i++) {
- Menu m = (Menu)menus.elementAt(i);
+ Menu m = menus.elementAt(i);
m.parent = this;
}
}
/**