@Override protected void paintText( final Graphics g, final JComponent c, final Rectangle textRect, final String text) { final AbstractButton b = (AbstractButton) c; final ButtonModel model = b.getModel(); final FontMetrics fm = SwingUtils.getFontMetrics(c, g); final int mnemonicIndex = b.getDisplayedMnemonicIndex(); // Drawing text if (model.isEnabled()) { // Normal text g.setColor(b.getForeground()); SwingUtils.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()); } else { // Disabled text g.setColor(b.getBackground().brighter()); SwingUtils.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); g.setColor(b.getBackground().darker()); SwingUtils.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x - 1, textRect.y + fm.getAscent() - 1); } }