-
Bug
-
Resolution: Fixed
-
P3
-
1.2.2
-
1.2.2
-
sparc
-
solaris_2.6
-
Verified
Name: asC58863 Date: 02/23/99
JTabbedPane.insertTab(String, Icon, Component, String) works incorrectly.
If we are adding some Component twice it should result in removing
the tab added first, and leaving the new tab in place. However it seems
not to work (see example).
This bug has appeared in JDK-1.2.2-H build and it looks like bug 4145598,
which has been fixed and integrated in 1.2fcs, has reappeared again.
Here is the example demonstrating the bug:
------------------ Test.java -----------------
import java.awt.*;
import javax.swing.*;
class Test {
public static void main(String[] argv) {
Component component = new Canvas();
String name = "Canvas";
Icon icon = new StubIcon();
String tip = "Canvas";
JTabbedPane c = new JTabbedPane();
c.addTab(name,component);
c.insertTab( name,icon,component,tip,0);
System.out.println(" ICON "+c.getIconAt(0));
System.exit(0);
}
}
class StubIcon implements Icon {
public void paintIcon(Component c, Graphics g, int x, int y) {}
public int getIconWidth() {return 0;}
public int getIconHeight() {return 0;}
}
-------------- Output from the test -----------------
(ans@matmech(pts/7): ~/work .331)
:\>java -fullversion
java full version "JDK-1.2.2-G"
(ans@matmech(pts/7): ~/work .331)
:\>java Test
ICON StubIcon@52ebe87d
(ans@matmech(pts/7): ~/work .331)
:\>java -fullversion
java full version "JDK-1.2.2-H"
(ans@matmech(pts/7): ~/work .331)
:\>java Test
ICON null
------------------------------------------------------
======================================================================
- relates to
-
JDK-4145598 JTabbedPane.insertTab(..) works wrong in JDK1.2-beta4
-
- Closed
-