< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java

Print this page




 220                   focusRect.width+1, focusRect.height+1);
 221 
 222     }
 223 
 224 
 225     protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
 226         AbstractButton b = (AbstractButton) c;
 227         ButtonModel model = b.getModel();
 228         FontMetrics fm = SwingUtilities2.getFontMetrics(c, g);
 229         int mnemIndex = b.getDisplayedMnemonicIndex();
 230 
 231         /* Draw the Text */
 232         if(model.isEnabled()) {
 233             /*** paint the text normally */
 234             g.setColor(b.getForeground());
 235         }
 236         else {
 237             /*** paint the text disabled ***/
 238             g.setColor(getDisabledTextColor());
 239         }
 240         SwingUtilities2.drawStringUnderlineCharAt(c, g,text,mnemIndex,
 241                                   textRect.x, textRect.y + fm.getAscent());
 242     }
 243 }


 220                   focusRect.width+1, focusRect.height+1);
 221 
 222     }
 223 
 224 
 225     protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
 226         AbstractButton b = (AbstractButton) c;
 227         ButtonModel model = b.getModel();
 228         FontMetrics fm = SwingUtilities2.getFontMetrics(c, g);
 229         int mnemIndex = b.getDisplayedMnemonicIndex();
 230 
 231         /* Draw the Text */
 232         if(model.isEnabled()) {
 233             /*** paint the text normally */
 234             g.setColor(b.getForeground());
 235         }
 236         else {
 237             /*** paint the text disabled ***/
 238             g.setColor(getDisabledTextColor());
 239         }
 240         getTextUIDrawing().drawStringUnderlineCharAt(c, g,text,mnemIndex,
 241                                   textRect.x, textRect.y + fm.getAscent());
 242     }
 243 }
< prev index next >