-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5.1
-
Verified
Name: akC57697 Date: 06/04/98
The com.sun.java.swing.JTabbedPane.insertTab(..) does not work properly in JDK1.2-beta4.
The example works properly under JDK1.2Beta3N but does not work under JDK1.2Beta4H:
------------------------------8-<--------------------------------------------
import com.sun.java.swing.JTabbedPane; // Warning: Do not forget to replace "com.sun.java.swing"
import com.sun.java.swing.Icon; // to "java.awt.swing" to test under former builds of JDK
public class Test {
public static void main(String s[]) {
String name = "Canvas";
StubIcon icon = new StubIcon();
JTabbedPane c = new JTabbedPane();
java.awt.Component comp = new java.awt.Canvas();
c.addTab("Checkbox",new java.awt.Checkbox()); // Add the couple of objects
c.addTab(name,comp);
c.insertTab("Choice",null,new java.awt.Choice(),"tip",0); //Insert at 0 position
c.insertTab(name,icon,comp,"tip",1); //Insert at 1 position
if (!( c.getTitleAt(1).equals(name) && c.getIconAt(1)==icon
&&
c.getComponentAt(1)==comp )) {
System.out.println("The JTabbedPane "+c);
System.out.println("The icon on 1 position is "+c.getIconAt(1)+
" must be "+icon);
System.out.println("The component is "+c.getComponentAt(1)+
" must be "+comp);
System.out.println("The name is "+c.getTitleAt(1)+
" must be "+name);
System.exit(0);
}
System.out.println("OKAY");
System.exit(0);
}
}
class StubIcon implements Icon {
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x,
int y) {}
public int getIconWidth() {return 0;}
public int getIconHeight() {return 0;}
}
---------------------------->-8-------------------------------------------
Output:
java full version "JDK-1.2beta3-N"
java Test
OKAY
java full version "JDK-1.2beta4-H"
java Test
The JTabbedPane com.sun.java.swing.JTabbedPane[,0,0,0x0,invalid,layout=com.sun.java.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout]
The icon on 1 position is null must be StubIcon@287c74d9
The component is java.awt.Checkbox[checkbox0,0,0,0x0,invalid,hidden,label=,state=false] must be java.awt.Canvas[canvas0,0,0,0x0,invalid,hidden]
The name is Checkbox must be Canvas
======================================================================
- relates to
-
JDK-4213896 JTabbedPane.insertTab() works incorrectly in JDK-1.2.2-H
-
- Closed
-