(Graphics g, JComponent c, Rectangle textRect, String text)
| 102 | |
| 103 | |
| 104 | protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) { |
| 105 | AbstractButton b = (AbstractButton) c; |
| 106 | ButtonModel model = b.getModel(); |
| 107 | FontMetrics fm = SwingUtilities2.getFontMetrics(c, g); |
| 108 | // FontMetrics fm = c.getFontMetrics(g.getFont()); |
| 109 | int mnemonicIndex = b.getDisplayedMnemonicIndex(); |
| 110 | |
| 111 | if (model.isPressed()) { |
| 112 | g.setColor(pressedFgColor); |
| 113 | } else if (model.isEnabled()) { |
| 114 | g.setColor(enabledFgColor); |
| 115 | } else { |
| 116 | g.setColor(disabledFgColor); |
| 117 | } |
| 118 | SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex, |
| 119 | textRect.x + getTextShiftOffset(), |
| 120 | textRect.y + fm.getAscent() + getTextShiftOffset()); |
| 121 | |
| 122 | // } else { |
| 123 | // //g.setColor(b.getBackground().brighter()); |
| 124 | // g.setColor(disabledFgColor); |
| 125 | // SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex, |
| 126 | // textRect.x, textRect.y + fm.getAscent()); |
| 127 | // } |
| 128 | } |
| 129 | |
| 130 | |
| 131 | public void updateTheme() { |
nothing calls this directly
no test coverage detected