src/share/classes/java/awt/Menu.java

Print this page

        

*** 64,74 **** initIDs(); } AWTAccessor.setMenuAccessor( new AWTAccessor.MenuAccessor() { ! public Vector getItems(Menu menu) { return menu.items; } }); } --- 64,74 ---- initIDs(); } AWTAccessor.setMenuAccessor( new AWTAccessor.MenuAccessor() { ! public Vector<MenuComponent> getItems(Menu menu) { return menu.items; } }); }
*** 76,86 **** * A vector of the items that will be part of the Menu. * * @serial * @see #countItems() */ ! Vector items = new Vector(); /** * This field indicates whether the menu has the * tear of property or not. It will be set to * <code>true</code> if the menu has the tear off --- 76,86 ---- * A vector of the items that will be part of the Menu. * * @serial * @see #countItems() */ ! Vector<MenuComponent> items = new Vector<>(); /** * This field indicates whether the menu has the * tear of property or not. It will be set to * <code>true</code> if the menu has the tear off
*** 311,321 **** if (index < 0) { throw new IllegalArgumentException("index less than zero."); } int nitems = getItemCount(); ! Vector tempItems = new Vector(); /* Remove the item at index, nitems-index times storing them in a temporary vector in the order they appear on the menu. */ --- 311,321 ---- if (index < 0) { throw new IllegalArgumentException("index less than zero."); } int nitems = getItemCount(); ! Vector<MenuItem> tempItems = new Vector<>(); /* Remove the item at index, nitems-index times storing them in a temporary vector in the order they appear on the menu. */
*** 328,338 **** /* Add the removed items back to the menu, they are already in the correct order in the temp vector. */ for (int i = 0; i < tempItems.size() ; i++) { ! add((MenuItem)tempItems.elementAt(i)); } } } /** --- 328,338 ---- /* Add the removed items back to the menu, they are already in the correct order in the temp vector. */ for (int i = 0; i < tempItems.size() ; i++) { ! add(tempItems.elementAt(i)); } } } /**
*** 377,387 **** if (index < 0) { throw new IllegalArgumentException("index less than zero."); } int nitems = getItemCount(); ! Vector tempItems = new Vector(); /* Remove the item at index, nitems-index times storing them in a temporary vector in the order they appear on the menu. */ --- 377,387 ---- if (index < 0) { throw new IllegalArgumentException("index less than zero."); } int nitems = getItemCount(); ! Vector<MenuItem> tempItems = new Vector<>(); /* Remove the item at index, nitems-index times storing them in a temporary vector in the order they appear on the menu. */
*** 394,404 **** /* Add the removed items back to the menu, they are already in the correct order in the temp vector. */ for (int i = 0; i < tempItems.size() ; i++) { ! add((MenuItem)tempItems.elementAt(i)); } } } /** --- 394,404 ---- /* Add the removed items back to the menu, they are already in the correct order in the temp vector. */ for (int i = 0; i < tempItems.size() ; i++) { ! add(tempItems.elementAt(i)); } } } /**
*** 473,489 **** } } return null; } ! synchronized Enumeration shortcuts() { ! Vector shortcuts = new Vector(); int nitems = getItemCount(); for (int i = 0 ; i < nitems ; i++) { MenuItem mi = getItem(i); if (mi instanceof Menu) { ! Enumeration e = ((Menu)mi).shortcuts(); while (e.hasMoreElements()) { shortcuts.addElement(e.nextElement()); } } else { MenuShortcut ms = mi.getShortcut(); --- 473,489 ---- } } return null; } ! synchronized Enumeration<MenuShortcut> shortcuts() { ! Vector<MenuShortcut> shortcuts = new Vector<>(); int nitems = getItemCount(); for (int i = 0 ; i < nitems ; i++) { MenuItem mi = getItem(i); if (mi instanceof Menu) { ! Enumeration<MenuShortcut> e = ((Menu)mi).shortcuts(); while (e.hasMoreElements()) { shortcuts.addElement(e.nextElement()); } } else { MenuShortcut ms = mi.getShortcut();