protected int calculateTabWidth(int tabPlacement,int tabIndex,FontMetrics metrics){
  final Font font=metrics.getFont();
  final FontMetrics plainMetrics=font.isPlain() ? metrics : tabPane.getFontMetrics(font.deriveFont(Font.PLAIN));
  final int widthPlain=super.calculateTabWidth(tabPlacement,tabIndex,plainMetrics);
  final FontMetrics boldMetrics=font.isBold() ? metrics : tabPane.getFontMetrics(font.deriveFont(Font.BOLD));
  final int widthBold=super.calculateTabWidth(tabPlacement,tabIndex,boldMetrics);
  final int width=Math.max(widthPlain,widthBold);
  myLayoutMetrics=(width == widthPlain) ? plainMetrics : boldMetrics;
  return width;
}

protected int calculateTabWidth ( int tabPlacement , int tabIndex , FontMetrics metrics ) { final Font font = metrics . getFont ( ) ; final FontMetrics plainMetrics = font . isPlain ( ) ? metrics : tabPane . getFontMetrics ( font . deriveFont ( Font . PLAIN ) ) ; final int widthPlain = super . calculateTabWidth ( tabPlacement , tabIndex , plainMetrics ) ; final FontMetrics boldMetrics = font . isBold ( ) ? metrics : tabPane . getFontMetrics ( font . deriveFont ( Font . BOLD ) ) ; final int widthBold = super . calculateTabWidth ( tabPlacement , tabIndex , boldMetrics ) ; final int width = Math . max ( widthPlain , widthBold ) ; myLayoutMetrics = ( width == widthPlain ) ? plainMetrics : boldMetrics ; return width ; }
ideatabbedpaneui uses bold font for selected tab . bold width of some fonts is less then width of plain font . to handle correctly this " anomaly " we have to determine maximum of these two widths .
