src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java

Print this page

        

@@ -96,11 +96,11 @@
     public Component getComponentAfter(Container aContainer,
                                        Component aComponent) {
         if (aContainer == null || aComponent == null) {
             throw new IllegalArgumentException("aContainer and aComponent cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
                                         getComponentOrientation());
         }

@@ -132,11 +132,11 @@
     public Component getComponentBefore(Container aContainer,
                                         Component aComponent) {
         if (aContainer == null || aComponent == null) {
             throw new IllegalArgumentException("aContainer and aComponent cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
                                         getComponentOrientation());
         }

@@ -156,11 +156,11 @@
      */
     public Component getFirstComponent(Container aContainer) {
         if (aContainer == null) {
             throw new IllegalArgumentException("aContainer cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
                                         getComponentOrientation());
         }

@@ -180,11 +180,11 @@
      */
     public Component getLastComponent(Container aContainer) {
         if (aContainer == null) {
             throw new IllegalArgumentException("aContainer cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
                                         getComponentOrientation());
         }

@@ -231,11 +231,11 @@
         } else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JTable")) {
             // JTable only has ancestor focus bindings, we thus force it
             // to be focusable by returning true here.
             return true;
         } else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) {
-            JComboBox box = (JComboBox)aComponent;
+            JComboBox<?> box = (JComboBox)aComponent;
             return box.getUI().isFocusTraversable(box);
         } else if (aComponent instanceof JComponent) {
             JComponent jComponent = (JComponent)aComponent;
             InputMap inputMap = jComponent.getInputMap(JComponent.WHEN_FOCUSED,
                                                        false);

@@ -254,14 +254,15 @@
 
     private void writeObject(ObjectOutputStream out) throws IOException {
         out.writeObject(getComparator());
         out.writeBoolean(getImplicitDownCycleTraversal());
     }
+    @SuppressWarnings("unchecked") // Cast to (Comparator<? super Component>)
     private void readObject(ObjectInputStream in)
         throws IOException, ClassNotFoundException
     {
-        setComparator((Comparator)in.readObject());
+        setComparator((Comparator<? super Component>)in.readObject());
         setImplicitDownCycleTraversal(in.readBoolean());
     }
 }
 
 // Create our own subclass and change accept to public so that we can call