public final void paintIcon(Component c,
Graphics g,
int x,
int y) {
JComponent component = (JComponent)c;
Font oldFont = g.getFont();
g.setFont(this.font);
if (component instanceof JToggleButton) {
AbstractButton b= (AbstractButton)component;
ButtonModel model = b.getModel();
if (model.isPressed() || model.isSelected()) {
g.setColor(Color.black); // xxx: foreground
} else {
g.setColor(Color.gray); // xxx: foreground light
}
}
g.drawString(this.label, x, (y + this.iconHeight) - 7);
g.setFont(oldFont);
}
|