summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schuster <theBohemian@gmx.net>2006-07-26 14:45:33 +0000
committerRobert Schuster <theBohemian@gmx.net>2006-07-26 14:45:33 +0000
commit665b827d593b5fc2a143aa77aa8f523f20567c76 (patch)
treecb4d2475955fcdc830ce96e0a144ada306323afd
parente7036024993a09589db0e49f278447dc647ca216 (diff)
downloadclasspath-665b827d593b5fc2a143aa77aa8f523f20567c76.tar.gz
2006-07-26 Robert Schuster <robertschuster@fsfe.org>
* javax/swing/JTabbedPane.java: (setSelectedIndex): Removed updating of component visibility status, added note.
-rw-r--r--ChangeLog6
-rw-r--r--javax/swing/JTabbedPane.java39
2 files changed, 25 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e3f3e92a1..b75eaf4b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-26 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/JTabbedPane.java:
+ (setSelectedIndex): Removed updating of component visibility status,
+ added note.
+
2006-07-26 Roman Kennke <kennke@aicas.com>
* javax/swing/JOptionPane.java
diff --git a/javax/swing/JTabbedPane.java b/javax/swing/JTabbedPane.java
index a7cc99fe1..5c8d04748 100644
--- a/javax/swing/JTabbedPane.java
+++ b/javax/swing/JTabbedPane.java
@@ -991,16 +991,8 @@ public class JTabbedPane extends JComponent implements Serializable,
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 class JTabbedPane extends JComponent implements Serializable,
*/
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 @@ public class JTabbedPane extends JComponent implements Serializable,
super.remove(i);
}
else
- super.remove(component);
+ removeTabAt(index);
}
/**