Hi,
actually the patch was applied in the following way:

2006-07-26  Robert Schuster <[EMAIL PROTECTED]>

        * javax/swing/JTabbedPane.java:
        (setSelectedIndex): Removed updating of component visibility status,
        added note.
        (remove(Component)): Use indexOfComponent() to find whether we have
        to use super.remove(int) or removeTabAt().

cya
Robert

Robert Schuster wrote:
> Hi,
> this reverts yesterdays change to JTabbedPane.setSelectedIndex and adds a 
> note.
> 
> ChangeLog:
> 
> 2006-07-26  Robert Schuster <[EMAIL PROTECTED]>
> 
>         * javax/swing/JTabbedPane.java:
>         (setSelectedIndex): Removed updating of component visibility status,
>         added note.
> 
> cya
> Robert
> 
> 

Index: javax/swing/JTabbedPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JTabbedPane.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- javax/swing/JTabbedPane.java	25 Jul 2006 19:20:28 -0000	1.42
+++ javax/swing/JTabbedPane.java	26 Jul 2006 14:45:33 -0000	1.43
@@ -991,16 +991,8 @@
     if (index != getSelectedIndex())
       {
         // Hiding and showing the involved components
-        // is important for the focus traversal mechanism
-        // to report the correct source and destination
-        // components.
-        Component c = getSelectedComponent();
-        if (c != null)
-          c.setVisible(false);
-        
+        // is done by the JTabbedPane's UI.
 	model.setSelectedIndex(index);
-        
-        getSelectedComponent().setVisible(true);
       }
   }
 
@@ -1257,17 +1249,24 @@
    */
   public void remove(Component component)
   {
-    // Container.remove(Component) is implemented in a
-    // way that it calls Container.remove(int). Since
-    // JTabbedPane's remove(int) is overridden to
-    // remove tabs and this in turn should not happen
-    // with components implementing UIResource
-    // we find out the component's index and
-    // call the superclass' remove(int) method
+    // Since components implementing UIResource
+    // are not added as regular tabs by the add()
+    // methods we have to take special care when
+    // removing these object. Especially 
+    // Container.remove(Component) cannot be used
+    // because it will call JTabbedPane.remove(int)
+    // later which is overridden and can only
+    // handle tab components.
+    // This implementation can even cope with a
+    // situation that someone called insertTab()
+    // with a component that implements UIResource.
+    int index = indexOfComponent(component);
+    
+    // If the component is not a tab component
+    // find out its Container-given index
+    // and call that class' implementation
     // directly.
-    // For non-UIResource implementing components
-    // the normal implementation is suitable.
-    if (component instanceof UIResource)
+    if (index == -1)
       {
         Component[] cs = getComponents();
         for (int i = 0; i< cs.length; i++)
@@ -1275,7 +1274,7 @@
             super.remove(i);
       }
     else
-      super.remove(component);
+      removeTabAt(index);
   }
 
   /**

Attachment: signature.asc
Description: PGP signature

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to