javax.swing.JTabbedPane.getBoundsAt(int) never returns null if UI is set

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P2
    • None
    • Affects Version/s: 6, 7
    • Component/s: client-libs

      Specification for javax.swing.JTabbedPane.getBoundsAt(int) says:

      "If the tab at this index is not currently visible in the UI, then returns null."

      This doesn't happen for all meanings of tab's visibility.

      Please see the following code sample:

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

      public class Tabs {

          public static void main(String[] args) {

              final JFrame jFrame = new JFrame();
              jFrame.setSize(100, 100);

              final JTabbedPane tabbedPane = new JTabbedPane();
              jFrame.add(tabbedPane);
              for (int i=0; i<50; i++) {
                  final JPanel panel = new JPanel();
                  panel.setBackground(new Color(i*5, i*5, i*5));
                  tabbedPane.add("panel " + i, panel);
              }

              tabbedPane.setSelectedIndex(20);
              jFrame.setVisible(true);

              for (int i=0; i<50; i++) {
                  System.out.println("i=" + i + ", getBoundsAt()=" + tabbedPane.getBoundsAt(i));
              }
          }
      }
      -----

            Assignee:
            Unassigned
            Reporter:
            Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: