boolean isSelected = tabIndex == tabPane.getSelectedIndex(); calcRect = getTabBounds(tabPane, tabIndex);  int x = calcRect.x; int y = calcRect.y; int w = calcRect.width; int h = calcRect.height; if (getRunForTab(tabPane.getTabCount(), tabIndex) == 1) { Insets insets = getTabAreaInsets(tabPlacement); switch (tabPlacement) { case TOP: h += insets.bottom; break; case LEFT: w += insets.right; break; case BOTTOM: y -= insets.top; h += insets.top; break; case RIGHT: x -= insets.left; w += insets.left; break; } }  layoutLabel(tabPlacement, fm, tabIndex, title, icon, calcRect, iconRect,
layoutLabel(tabPlacement, fm, tabIndex, title, icon, rect, iconRect,
  protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects,                          int tabIndex, Rectangle iconRect, Rectangle textRect)  {    FontMetrics fm = getFontMetrics();    Icon icon = getIconForTab(tabIndex);    String title = tabPane.getTitleAt(tabIndex);    boolean isSelected = tabIndex == tabPane.getSelectedIndex();    calcRect = getTabBounds(tabPane, tabIndex);    int x = calcRect.x;    int y = calcRect.y;    int w = calcRect.width;    int h = calcRect.height;    if (getRunForTab(tabPane.getTabCount(), tabIndex) == 1)      {        Insets insets = getTabAreaInsets(tabPlacement);        switch (tabPlacement)        {        case TOP:          h += insets.bottom;          break;        case LEFT:          w += insets.right;          break;        case BOTTOM:          y -= insets.top;          h += insets.top;          break;        case RIGHT:          x -= insets.left;          w += insets.left;          break;        }      }    layoutLabel(tabPlacement, fm, tabIndex, title, icon, calcRect, iconRect,                textRect, isSelected);    paintTabBackground(g, tabPlacement, tabIndex, x, y, w, h, isSelected);    paintTabBorder(g, tabPlacement, tabIndex, x, y, w, h, isSelected);    // FIXME: Paint little folding corner and jagged edge clipped tab.    if (icon != null)      paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);    if (title != null && ! title.equals(""))      paintText(g, tabPlacement, tabPane.getFont(), fm, tabIndex, title,                textRect, isSelected);  }