38 |
|
|
39 |
package javax.swing.plaf.metal; |
package javax.swing.plaf.metal; |
40 |
|
|
41 |
|
import java.awt.Color; |
42 |
|
|
43 |
import javax.swing.AbstractButton; |
import javax.swing.AbstractButton; |
44 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
45 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
58 |
extends BasicButtonUI |
extends BasicButtonUI |
59 |
{ |
{ |
60 |
|
|
|
// FIXME: probably substitute with a Map in the future in the case |
|
|
// that this UI becomes stateful |
|
|
|
|
61 |
/** The cached MetalButtonUI instance. */ |
/** The cached MetalButtonUI instance. */ |
62 |
private static MetalButtonUI instance = null; |
private static MetalButtonUI instance = null; |
63 |
|
|
64 |
|
/** The color for the focus border. */ |
65 |
|
protected Color focusColor; |
66 |
|
|
67 |
|
/** The color that indicates a selected button. */ |
68 |
|
protected Color selectColor; |
69 |
|
|
70 |
|
/** The color for disabled button labels. */ |
71 |
|
protected Color disabledTextColor; |
72 |
|
|
73 |
/** |
/** |
74 |
* Creates a new instance of MetalButtonUI. |
* Creates a new instance of MetalButtonUI. |
75 |
*/ |
*/ |
76 |
public MetalButtonUI() |
public MetalButtonUI() |
77 |
{ |
{ |
78 |
super(); |
super(); |
79 |
|
focusColor = getFocusColor(); |
80 |
|
selectColor = getSelectColor(); |
81 |
|
disabledTextColor = getDisabledTextColor(); |
82 |
|
} |
83 |
|
|
84 |
|
/** |
85 |
|
* Returns the color for the focus border. |
86 |
|
* |
87 |
|
* @return the color for the focus border |
88 |
|
*/ |
89 |
|
protected Color getFocusColor() |
90 |
|
{ |
91 |
|
UIDefaults def = UIManager.getLookAndFeelDefaults(); |
92 |
|
return def.getColor(getPropertyPrefix() + ".focus"); |
93 |
|
} |
94 |
|
|
95 |
|
/** |
96 |
|
* Returns the color that indicates a selected button. |
97 |
|
* |
98 |
|
* @return the color that indicates a selected button |
99 |
|
*/ |
100 |
|
protected Color getSelectColor() |
101 |
|
{ |
102 |
|
UIDefaults def = UIManager.getLookAndFeelDefaults(); |
103 |
|
return def.getColor(getPropertyPrefix() + ".select"); |
104 |
|
} |
105 |
|
|
106 |
|
/** |
107 |
|
* Returns the color for the text label of disabled buttons. |
108 |
|
* |
109 |
|
* @return the color for the text label of disabled buttons |
110 |
|
*/ |
111 |
|
protected Color getDisabledTextColor() |
112 |
|
{ |
113 |
|
UIDefaults def = UIManager.getLookAndFeelDefaults(); |
114 |
|
return def.getColor(getPropertyPrefix() + ".disabledText"); |
115 |
} |
} |
116 |
|
|
117 |
/** |
/** |