Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6632162

Nimbus L&F : JTabbedPane titles over laps to each other

    XMLWordPrintable

Details

    • x86
    • windows_vista

    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.

      Attachments

        Issue Links

          Activity

            People

              peterz Peter Zhelezniakov
              lpremkumsunw Lawrence Premkumar1 (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: