< prev index next >

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

Print this page




 227 
 228         } else {
 229             getDefaultIcon().paintIcon(c, g, iconRect.x, iconRect.y);
 230         }
 231 
 232 
 233         // Draw the Text
 234         if(text != null) {
 235             View v = (View) c.getClientProperty(BasicHTML.propertyKey);
 236             if (v != null) {
 237                 v.paint(g, textRect);
 238             } else {
 239                int mnemIndex = b.getDisplayedMnemonicIndex();
 240                if(model.isEnabled()) {
 241                    // *** paint the text normally
 242                    g.setColor(b.getForeground());
 243                } else {
 244                    // *** paint the text disabled
 245                    g.setColor(getDisabledTextColor());
 246                }
 247                SwingUtilities2.drawStringUnderlineCharAt(c,g,text,
 248                        mnemIndex, textRect.x, textRect.y + fm.getAscent());
 249            }
 250            if(b.hasFocus() && b.isFocusPainted() &&
 251               textRect.width > 0 && textRect.height > 0 ) {
 252                paintFocus(g,textRect,size);
 253            }
 254         }
 255     }
 256 
 257     protected void paintFocus(Graphics g, Rectangle t, Dimension d){
 258         g.setColor(getFocusColor());
 259         g.drawRect(t.x-1, t.y-1, t.width+1, t.height+1);
 260     }
 261 }


 227 
 228         } else {
 229             getDefaultIcon().paintIcon(c, g, iconRect.x, iconRect.y);
 230         }
 231 
 232 
 233         // Draw the Text
 234         if(text != null) {
 235             View v = (View) c.getClientProperty(BasicHTML.propertyKey);
 236             if (v != null) {
 237                 v.paint(g, textRect);
 238             } else {
 239                int mnemIndex = b.getDisplayedMnemonicIndex();
 240                if(model.isEnabled()) {
 241                    // *** paint the text normally
 242                    g.setColor(b.getForeground());
 243                } else {
 244                    // *** paint the text disabled
 245                    g.setColor(getDisabledTextColor());
 246                }
 247                getTextUIDrawing().drawStringUnderlineCharAt(c,g,text,
 248                        mnemIndex, textRect.x, textRect.y + fm.getAscent());
 249            }
 250            if(b.hasFocus() && b.isFocusPainted() &&
 251               textRect.width > 0 && textRect.height > 0 ) {
 252                paintFocus(g,textRect,size);
 253            }
 254         }
 255     }
 256 
 257     protected void paintFocus(Graphics g, Rectangle t, Dimension d){
 258         g.setColor(getFocusColor());
 259         g.drawRect(t.x-1, t.y-1, t.width+1, t.height+1);
 260     }
 261 }
< prev index next >