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

Print this page

        

@@ -64,11 +64,11 @@
             initIDs();
         }
 
         AWTAccessor.setMenuAccessor(
             new AWTAccessor.MenuAccessor() {
-                public Vector getItems(Menu menu) {
+                public Vector<MenuComponent> getItems(Menu menu) {
                     return menu.items;
                 }
             });
     }
 

@@ -76,11 +76,11 @@
      * A vector of the items that will be part of the Menu.
      *
      * @serial
      * @see #countItems()
      */
-    Vector              items = new Vector();
+    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,11 +311,11 @@
             if (index < 0) {
                 throw new IllegalArgumentException("index less than zero.");
             }
 
             int nitems = getItemCount();
-            Vector tempItems = new Vector();
+            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,11 +328,11 @@
 
             /* 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));
+                add(tempItems.elementAt(i));
             }
         }
     }
 
     /**

@@ -377,11 +377,11 @@
             if (index < 0) {
                 throw new IllegalArgumentException("index less than zero.");
             }
 
             int nitems = getItemCount();
-            Vector tempItems = new Vector();
+            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,11 +394,11 @@
 
             /* 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));
+                add(tempItems.elementAt(i));
             }
         }
     }
 
     /**

@@ -473,17 +473,17 @@
             }
         }
         return null;
     }
 
-    synchronized Enumeration shortcuts() {
-        Vector shortcuts = new Vector();
+    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 e = ((Menu)mi).shortcuts();
+                Enumeration<MenuShortcut> e = ((Menu)mi).shortcuts();
                 while (e.hasMoreElements()) {
                     shortcuts.addElement(e.nextElement());
                 }
             } else {
                 MenuShortcut ms = mi.getShortcut();