46 |
import javax.swing.AbstractButton; |
import javax.swing.AbstractButton; |
47 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
48 |
import javax.swing.JRadioButton; |
import javax.swing.JRadioButton; |
|
import javax.swing.UIDefaults; |
|
49 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
50 |
import javax.swing.plaf.ComponentUI; |
import javax.swing.plaf.ComponentUI; |
51 |
import javax.swing.plaf.basic.BasicRadioButtonUI; |
import javax.swing.plaf.basic.BasicRadioButtonUI; |
95 |
public void installDefaults(AbstractButton b) |
public void installDefaults(AbstractButton b) |
96 |
{ |
{ |
97 |
super.installDefaults(b); |
super.installDefaults(b); |
98 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
disabledTextColor = UIManager.getColor("RadioButton.disabledText"); |
99 |
disabledTextColor = defaults.getColor("RadioButton.disabledText"); |
focusColor = UIManager.getColor("RadioButton.focus"); |
100 |
focusColor = defaults.getColor("RadioButton.focus"); |
selectColor = UIManager.getColor("RadioButton.select"); |
|
selectColor = defaults.getColor("RadioButton.select"); |
|
101 |
} |
} |
102 |
|
|
103 |
/** |
/** |
116 |
/** |
/** |
117 |
* Returns the color used to fill the {@link JRadioButton}'s icon when the |
* Returns the color used to fill the {@link JRadioButton}'s icon when the |
118 |
* button is pressed. The default color is obtained from the |
* button is pressed. The default color is obtained from the |
119 |
* {@link UIDefaults} via an entry with the key |
* {@link UIManager} defaults via an entry with the key |
120 |
* <code>RadioButton.select</code>. |
* <code>RadioButton.select</code>. |
121 |
* |
* |
122 |
* @return The select color. |
* @return The select color. |
128 |
|
|
129 |
/** |
/** |
130 |
* Returns the color for the {@link JRadioButton}'s text when the button is |
* Returns the color for the {@link JRadioButton}'s text when the button is |
131 |
* disabled. The default color is obtained from the {@link UIDefaults} via |
* disabled. The default color is obtained from the {@link UIManager} |
132 |
* an entry with the key <code>RadioButton.disabledText</code>. |
* defaults via an entry with the key <code>RadioButton.disabledText</code>. |
133 |
* |
* |
134 |
* @return The disabled text color. |
* @return The disabled text color. |
135 |
*/ |
*/ |
141 |
/** |
/** |
142 |
* Returns the color used to draw the focus rectangle when the |
* Returns the color used to draw the focus rectangle when the |
143 |
* {@link JRadioButton} has the focus. The default color is obtained from |
* {@link JRadioButton} has the focus. The default color is obtained from |
144 |
* the {@link UIDefaults} via an entry with the key |
* the {@link UIManager} defaults via an entry with the key |
145 |
* <code>RadioButton.focus</code>. |
* <code>RadioButton.focus</code>. |
146 |
* |
* |
147 |
* @return The color used to draw the focus rectangle. |
* @return The color used to draw the focus rectangle. |
176 |
protected void paintFocus(Graphics g, Rectangle t, Dimension d) |
protected void paintFocus(Graphics g, Rectangle t, Dimension d) |
177 |
{ |
{ |
178 |
g.setColor(focusColor); |
g.setColor(focusColor); |
179 |
// minus 2 because of line thickness. Prevents border |
g.drawRect(t.x - 1, t.y + 2, t.width + 2, t.height - 4); |
|
// from being cutoff. |
|
|
g.drawRect(t.x, t.y, t.width - 2, t.height - 2); |
|
180 |
} |
} |
181 |
|
|
182 |
} |
} |