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

[macosx] Incorrect minimal heigh of JTabbedPane with more tabs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u60, 9
    • client-libs
    • b116
    • os_x

      JDK 8u60, OSX, Aqua L&F

      The more tabs are added to JTabbedPane the higher is pane.getMinimumSize().height even though the tabs are in one row and should not have any impact on the component's height.

      The following sample code shows the behaviour.

      package aquatest;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JTabbedPane;

      public class AquaTabbedPaneTest {

          public static void main(String[] args) {

              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              JTabbedPane pane = new JTabbedPane();
              pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
              f.add(pane);
              for (int i = 0; i < 20; i++) {
                  String title = "Tab" + (i + 1);
                  pane.addTab(title, new JPanel());
                  if (i < 5 || i == 9 || i == 19) {
                      System.out.format("Tabs: %4d Minimal height: %5d\n",
                              i + 1, pane.getMinimumSize().height);
                  }
              }
          }
      }

            aniyogi Avik Niyogi (Inactive)
            anebuzel Antonín Nebuželský
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: