75 |
import javax.swing.event.ListDataListener; |
import javax.swing.event.ListDataListener; |
76 |
import javax.swing.plaf.ComboBoxUI; |
import javax.swing.plaf.ComboBoxUI; |
77 |
import javax.swing.plaf.ComponentUI; |
import javax.swing.plaf.ComponentUI; |
78 |
|
import javax.swing.plaf.UIResource; |
79 |
|
|
80 |
/** |
/** |
81 |
* UI Delegate for JComboBox |
* UI Delegate for JComboBox |
159 |
private Color shadow; |
private Color shadow; |
160 |
private Color darkShadow; |
private Color darkShadow; |
161 |
private Color highlight; |
private Color highlight; |
|
private Color lightHighlight; |
|
162 |
|
|
163 |
/* Size of the largest item in the comboBox |
/* Size of the largest item in the comboBox |
164 |
* This is package-private to avoid an accessor method. |
* This is package-private to avoid an accessor method. |
245 |
{ |
{ |
246 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
247 |
|
|
248 |
comboBox.setBackground(defaults.getColor("ComboBox.background")); |
if (comboBox.getFont() instanceof UIResource) |
249 |
comboBox.setFont(defaults.getFont("ComboBox.font")); |
comboBox.setFont(defaults.getFont("ComboBox.font")); |
250 |
comboBox.setForeground(defaults.getColor("ComboBox.foreground")); |
|
251 |
|
if (comboBox.getForeground() instanceof UIResource) |
252 |
// Set default color that should be used to to render selected item |
comboBox.setForeground(defaults.getColor("ComboBox.foreground")); |
253 |
// of the combo box. |
|
254 |
shadow = defaults.getColor("Button.shadow"); |
if (comboBox.getBackground() instanceof UIResource) |
255 |
darkShadow = defaults.getColor("Button.darkShadow"); |
comboBox.setBackground(defaults.getColor("ComboBox.background")); |
256 |
lightHighlight = defaults.getColor("Button.light"); |
|
257 |
highlight = defaults.getColor("Button.highlight"); |
// fetch the button color scheme |
258 |
|
shadow = defaults.getColor("ComboBox.buttonShadow"); |
259 |
|
darkShadow = defaults.getColor("ComboBox.buttonDarkShadow"); |
260 |
|
highlight = defaults.getColor("ComboBox.buttonHighlight"); |
261 |
} |
} |
262 |
|
|
263 |
/** |
/** |
294 |
*/ |
*/ |
295 |
protected void uninstallDefaults() |
protected void uninstallDefaults() |
296 |
{ |
{ |
297 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
if (comboBox.getFont() instanceof UIResource) |
298 |
|
comboBox.setFont(null); |
299 |
|
|
300 |
comboBox.setBackground(null); |
if (comboBox.getForeground() instanceof UIResource) |
301 |
comboBox.setFont(null); |
comboBox.setForeground(null); |
302 |
comboBox.setForeground(null); |
|
303 |
|
if (comboBox.getBackground() instanceof UIResource) |
304 |
|
comboBox.setBackground(null); |
305 |
|
|
306 |
shadow = null; |
shadow = null; |
307 |
darkShadow = null; |
darkShadow = null; |
|
lightHighlight = null; |
|
308 |
highlight = null; |
highlight = null; |
309 |
} |
} |
310 |
|
|