for (int i = 0; i < tabPane.getTabCount(); i++)
int count = tabPane.getTabCount(); for (int i = 0; i < count; i++)
    protected Dimension calculateSize(boolean minimum)    {      int tabPlacement = tabPane.getTabPlacement();      int width = 0;      int height = 0;      Component c;      Dimension dims;      // Find out the minimum/preferred size to display the largest child      // of the tabbed pane.      for (int i = 0; i < tabPane.getTabCount(); i++)        {          c = tabPane.getComponentAt(i);          if (c == null)            continue;          dims = minimum ? c.getMinimumSize() : c.getPreferredSize();           if (dims != null)            {              height = Math.max(height, dims.height);              width = Math.max(width, dims.width);            }        }      Insets tabAreaInsets = getTabAreaInsets(tabPlacement);      if (tabPlacement == SwingConstants.TOP          || tabPlacement == SwingConstants.BOTTOM)        {          int min = calculateMaxTabWidth(tabPlacement);          width = Math.max(min, width);          int tabAreaHeight = preferredTabAreaHeight(tabPlacement,                                                     width - tabAreaInsets.left                                                     - tabAreaInsets.right);          height += tabAreaHeight;        }      else        {          int min = calculateMaxTabHeight(tabPlacement);          height = Math.max(min, height);          int tabAreaWidth = preferredTabAreaWidth(tabPlacement,                                                   height - tabAreaInsets.top                                                   - tabAreaInsets.bottom);          width += tabAreaWidth;        }      Insets tabPaneInsets = tabPane.getInsets();      return new Dimension(width + tabPaneInsets.left + tabPaneInsets.right,                           height + tabPaneInsets.top + tabPaneInsets.bottom);    }