JDK-6632162 : Nimbus L&F : JTabbedPane titles over laps to each other
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u10
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2007-11-20
  • Updated: 2012-03-22
  • Resolved: 2010-04-07
Related Reports
Duplicate :  
Relates :  
Description
JTabbedPane titles over laps to each other , when resizing the frame. I have attached the screen shot of the same.
Step to reproduced:
-------------------
1) Run SwingSet2.
2) Resize the frame as show in the figure & if you see the jtabbed pane first tab title overlaps to second one , then bug is reproduced.

This is seen in all nimbus build right from the first build.
I suspect that JCK test api/javax_swing/JTabbedPane/AccessibleJTabbedPane/index.html#AccessibleComponent fails due to this.

Consider this small test made from original test:

import java.awt.*;
import javax.accessibility.*;
import javax.swing.*;


public class test {

    public static void main(String argv[]) {
        JTabbedPane o = new JTabbedPane();
        AccessibleComponent c =
                o.getAccessibleContext().getAccessibleComponent();
        JButton test[] = new JButton[5];

        for (int i = 0; i < 5; i++) {
            test[i] = new JButton("Test" + i);
            o.addTab("Test" + i, test[i]);
        }
        o.setSize(500, 500);

        for (int i = 0; i < 5; i++) {
            Point p = new Point(o.getBoundsAt(i).x , o.getBoundsAt(i).y );
            System.out.println(o.getBoundsAt(i));
            System.out.println(p);
            if (c.getAccessibleAt(p).getAccessibleContext().getAccessibleIndexInParent() != i) {
                System.out.println(o.indexAtLocation(o.getBoundsAt(i).x, o.getBoundsAt(i).y));
                System.out.println("Returned index " + c.getAccessibleAt(p).getAccessibleContext().getAccessibleIndexInParent());
                System.out.println("public Accessible getAccessibleAt(Point point) test failed " + i);
            } else {
                System.out.println(o.indexAtLocation(o.getBoundsAt(i).x, o.getBoundsAt(i).y));
                System.out.println("Returned index " + c.getAccessibleAt(p).getAccessibleContext().getAccessibleIndexInParent());
                System.out.println("public Accessible getAccessibleAt(Point point) test passed. " + i);
            }
        }
    }
}

It's output is:

[..@..]$ /export/jdk/jdk1.6.0_18/bin/java -cp . test
java.awt.Rectangle[x=2,y=2,width=53,height=19]
java.awt.Point[x=2,y=2]
0
Returned index 0
public Accessible getAccessibleAt(Point point) test passed. 0
java.awt.Rectangle[x=55,y=2,width=53,height=19]
java.awt.Point[x=55,y=2]
1
Returned index 1
public Accessible getAccessibleAt(Point point) test passed. 1
java.awt.Rectangle[x=108,y=2,width=53,height=19]
java.awt.Point[x=108,y=2]
2
Returned index 2
public Accessible getAccessibleAt(Point point) test passed. 2
java.awt.Rectangle[x=161,y=2,width=53,height=19]
java.awt.Point[x=161,y=2]
3
Returned index 3
public Accessible getAccessibleAt(Point point) test passed. 3
java.awt.Rectangle[x=214,y=2,width=53,height=19]
java.awt.Point[x=214,y=2]
4
Returned index 4
public Accessible getAccessibleAt(Point point) test passed. 4

With NIMBUS L&F
[..@...]$ /export/jdk/jdk1.6.0_18/bin/java -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel -cp . test

java.awt.Rectangle[x=10,y=3,width=50,height=22]
java.awt.Point[x=10,y=3]
0
Returned index 0
public Accessible getAccessibleAt(Point point) test passed. 0
java.awt.Rectangle[x=59,y=3,width=51,height=22]
java.awt.Point[x=59,y=3]
0
Returned index 0
public Accessible getAccessibleAt(Point point) test failed 1
java.awt.Rectangle[x=109,y=3,width=51,height=22]
java.awt.Point[x=109,y=3]
1
Returned index 1
public Accessible getAccessibleAt(Point point) test failed 2
java.awt.Rectangle[x=159,y=3,width=51,height=22]
java.awt.Point[x=159,y=3]
2
Returned index 2
public Accessible getAccessibleAt(Point point) test failed 3
java.awt.Rectangle[x=209,y=3,width=51,height=22]
java.awt.Point[x=209,y=3]
3
Returned index 3
public Accessible getAccessibleAt(Point point) test failed 4

As we could see - tabs overlaps to each other and the first one have different size.

Comments
EVALUATION The CR is actually split to two parts: = The JCK test itself The provided test case makes try to guess the positing of the tabs for different L&F which is acutally impossible because different L&F may place the tabs differently, using different insets and layouts. This test accidentally works for the Mental, Windows and Motif L&F but doesn't suit the Nimus L&F, which layouts the tabs in a different way. So I suggest rewriting the test or excluding it for the Nimbus. = The overlapped tabs We has had this problem for ages for different L&F, it is easy to reproduce e.g. with Metal L&F (see the attached 6632162.png) and it is just a P4 bug which has nothing to do with conformance, closed as a duplicate of the existing 4975366 bug
07-04-2010

EVALUATION In Metal and Windows Laf, tabs are placed in two rows in this case
20-11-2007