@Override
  protected void paintText(Graphics g, int tabPlacement,
                           Font font, FontMetrics metrics, int tabIndex,
                           String title, Rectangle textRect,
                           boolean isSelected) {
    if (isSelected) {
      font = font.isBold()? font : font.deriveFont(Font.BOLD);
      metrics = metrics.getFont().isBold()? metrics : g.getFontMetrics(font);
    }
    else {
      font = font.isPlain()? font : font.deriveFont(Font.PLAIN);
      metrics = metrics.getFont().isPlain()? metrics : g.getFontMetrics(font);
    }
    g.setFont(font);
    if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
      g.setColor(tabPane.getForegroundAt(tabIndex));
      g.drawString(title, textRect.x - (myNoIconSpace ? 5 : 0), textRect.y + metrics.getAscent());
    }
    else {
      // tab disabled
      g.setColor(tabPane.getBackgroundAt(tabIndex).brighter());
      g.drawString(title, textRect.x, textRect.y + metrics.getAscent());
      g.setColor(tabPane.getBackgroundAt(tabIndex).darker());
      g.drawString(title, textRect.x - (myNoIconSpace ? 6 : 1), textRect.y + metrics.getAscent() - 1);
    }
  }
@Override
  protected void paintText(Graphics g, int tabPlacement,
                           Font font, FontMetrics metrics, int tabIndex,
                           String title, Rectangle textRect,
                           boolean isSelected)