51 |
import javax.swing.JPopupMenu; |
import javax.swing.JPopupMenu; |
52 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
53 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
|
import javax.swing.UIDefaults; |
|
54 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
55 |
import javax.swing.border.AbstractBorder; |
import javax.swing.border.AbstractBorder; |
56 |
import javax.swing.border.BevelBorder; |
import javax.swing.border.BevelBorder; |
94 |
*/ |
*/ |
95 |
public static Border getButtonBorder() |
public static Border getButtonBorder() |
96 |
{ |
{ |
|
UIDefaults defaults; |
|
97 |
Border outer; |
Border outer; |
98 |
|
|
|
defaults = UIManager.getLookAndFeelDefaults(); |
|
|
|
|
99 |
/* The keys for UIDefaults have been determined by writing a |
/* The keys for UIDefaults have been determined by writing a |
100 |
* test program that dumps the UIDefaults to stdout; that program |
* test program that dumps the UIDefaults to stdout; that program |
101 |
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API, |
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API, |
102 |
* the key "light" is usually called "highlight", and "highlight" |
* the key "light" is usually called "highlight", and "highlight" |
103 |
* is usually called "lightHighlight". |
* is usually called "lightHighlight". |
104 |
*/ |
*/ |
105 |
outer = new ButtonBorder(defaults.getColor("Button.shadow"), |
outer = new ButtonBorder(UIManager.getColor("Button.shadow"), |
106 |
defaults.getColor("Button.darkShadow"), |
UIManager.getColor("Button.darkShadow"), |
107 |
defaults.getColor("Button.light"), |
UIManager.getColor("Button.light"), |
108 |
defaults.getColor("Button.highlight")); |
UIManager.getColor("Button.highlight")); |
109 |
|
|
110 |
/* While the inner border is shared between multiple buttons, |
/* While the inner border is shared between multiple buttons, |
111 |
* we do not share the outer border because ButtonBorders store |
* we do not share the outer border because ButtonBorders store |
141 |
*/ |
*/ |
142 |
public static Border getRadioButtonBorder() |
public static Border getRadioButtonBorder() |
143 |
{ |
{ |
|
UIDefaults defaults; |
|
144 |
Border outer; |
Border outer; |
145 |
|
|
|
defaults = UIManager.getLookAndFeelDefaults(); |
|
|
|
|
146 |
/* The keys for UIDefaults have been determined by writing a |
/* The keys for UIDefaults have been determined by writing a |
147 |
* test program that dumps the UIDefaults to stdout; that program |
* test program that dumps the UIDefaults to stdout; that program |
148 |
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API, |
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API, |
150 |
* is usually called "lightHighlight". |
* is usually called "lightHighlight". |
151 |
*/ |
*/ |
152 |
outer = new RadioButtonBorder( |
outer = new RadioButtonBorder( |
153 |
defaults.getColor("RadioButton.shadow"), |
UIManager.getColor("RadioButton.shadow"), |
154 |
defaults.getColor("RadioButton.darkShadow"), |
UIManager.getColor("RadioButton.darkShadow"), |
155 |
defaults.getColor("RadioButton.light"), |
UIManager.getColor("RadioButton.light"), |
156 |
defaults.getColor("RadioButton.highlight")); |
UIManager.getColor("RadioButton.highlight")); |
157 |
|
|
158 |
/* While the inner border is shared between multiple buttons, we |
/* While the inner border is shared between multiple buttons, we |
159 |
* do not share the outer border because RadioButtonBorders, being |
* do not share the outer border because RadioButtonBorders, being |
190 |
*/ |
*/ |
191 |
public static Border getToggleButtonBorder() |
public static Border getToggleButtonBorder() |
192 |
{ |
{ |
|
UIDefaults defaults; |
|
193 |
Border outer; |
Border outer; |
194 |
|
|
|
defaults = UIManager.getLookAndFeelDefaults(); |
|
|
|
|
195 |
/* The keys for UIDefaults have been determined by writing a |
/* The keys for UIDefaults have been determined by writing a |
196 |
* test program that dumps the UIDefaults to stdout; that program |
* test program that dumps the UIDefaults to stdout; that program |
197 |
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API, |
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API, |
199 |
* is usually called "lightHighlight". |
* is usually called "lightHighlight". |
200 |
*/ |
*/ |
201 |
outer = new ToggleButtonBorder( |
outer = new ToggleButtonBorder( |
202 |
defaults.getColor("ToggleButton.shadow"), |
UIManager.getColor("ToggleButton.shadow"), |
203 |
defaults.getColor("ToggleButton.darkShadow"), |
UIManager.getColor("ToggleButton.darkShadow"), |
204 |
defaults.getColor("ToggleButton.light"), |
UIManager.getColor("ToggleButton.light"), |
205 |
defaults.getColor("ToggleButton.highlight")); |
UIManager.getColor("ToggleButton.highlight")); |
206 |
|
|
207 |
/* While the inner border is shared between multiple buttons, we |
/* While the inner border is shared between multiple buttons, we |
208 |
* do not share the outer border because ToggleButtonBorders, being |
* do not share the outer border because ToggleButtonBorders, being |
237 |
*/ |
*/ |
238 |
public static Border getMenuBarBorder() |
public static Border getMenuBarBorder() |
239 |
{ |
{ |
|
UIDefaults defaults; |
|
|
|
|
240 |
/* See comment in methods above for why this border is not shared. */ |
/* See comment in methods above for why this border is not shared. */ |
241 |
defaults = UIManager.getLookAndFeelDefaults(); |
return new MenuBarBorder(UIManager.getColor("MenuBar.shadow"), |
242 |
return new MenuBarBorder(defaults.getColor("MenuBar.shadow"), |
UIManager.getColor("MenuBar.highlight")); |
|
defaults.getColor("MenuBar.highlight")); |
|
243 |
} |
} |
244 |
|
|
245 |
|
|
266 |
*/ |
*/ |
267 |
public static Border getSplitPaneBorder() |
public static Border getSplitPaneBorder() |
268 |
{ |
{ |
|
UIDefaults defaults; |
|
|
|
|
269 |
/* See comment in methods above for why this border is not shared. */ |
/* See comment in methods above for why this border is not shared. */ |
270 |
defaults = UIManager.getLookAndFeelDefaults(); |
return new SplitPaneBorder(UIManager.getColor("SplitPane.highlight"), |
271 |
return new SplitPaneBorder(defaults.getColor("SplitPane.highlight"), |
UIManager.getColor("SplitPane.darkShadow")); |
|
defaults.getColor("SplitPane.darkShadow")); |
|
272 |
} |
} |
273 |
|
|
274 |
|
|
298 |
*/ |
*/ |
299 |
public static Border getSplitPaneDividerBorder() |
public static Border getSplitPaneDividerBorder() |
300 |
{ |
{ |
|
UIDefaults defaults; |
|
|
|
|
301 |
/* See comment in methods above for why this border is not shared. */ |
/* See comment in methods above for why this border is not shared. */ |
|
defaults = UIManager.getLookAndFeelDefaults(); |
|
302 |
return new SplitPaneDividerBorder( |
return new SplitPaneDividerBorder( |
303 |
defaults.getColor("SplitPane.highlight"), |
UIManager.getColor("SplitPane.highlight"), |
304 |
defaults.getColor("SplitPane.darkShadow")); |
UIManager.getColor("SplitPane.darkShadow")); |
305 |
} |
} |
306 |
|
|
307 |
|
|
327 |
*/ |
*/ |
328 |
public static Border getTextFieldBorder() |
public static Border getTextFieldBorder() |
329 |
{ |
{ |
|
UIDefaults defaults; |
|
|
|
|
330 |
/* See comment in methods above for why this border is not shared. */ |
/* See comment in methods above for why this border is not shared. */ |
|
defaults = UIManager.getLookAndFeelDefaults(); |
|
331 |
return new FieldBorder( |
return new FieldBorder( |
332 |
defaults.getColor("TextField.shadow"), |
UIManager.getColor("TextField.shadow"), |
333 |
defaults.getColor("TextField.darkShadow"), |
UIManager.getColor("TextField.darkShadow"), |
334 |
defaults.getColor("TextField.light"), |
UIManager.getColor("TextField.light"), |
335 |
defaults.getColor("TextField.highlight")); |
UIManager.getColor("TextField.highlight")); |
336 |
} |
} |
337 |
|
|
338 |
|
|
372 |
*/ |
*/ |
373 |
public static Border getInternalFrameBorder() |
public static Border getInternalFrameBorder() |
374 |
{ |
{ |
|
UIDefaults defaults; |
|
375 |
Color shadow, darkShadow, highlight, lightHighlight, line; |
Color shadow, darkShadow, highlight, lightHighlight, line; |
376 |
|
|
377 |
/* See comment in methods above for why this border is not shared. */ |
/* See comment in methods above for why this border is not shared. */ |
378 |
defaults = UIManager.getLookAndFeelDefaults(); |
shadow = UIManager.getColor("InternalFrame.borderShadow"); |
379 |
|
darkShadow = UIManager.getColor("InternalFrame.borderDarkShadow"); |
380 |
shadow = defaults.getColor("InternalFrame.borderShadow"); |
highlight = UIManager.getColor("InternalFrame.borderLight"); |
381 |
darkShadow = defaults.getColor("InternalFrame.borderDarkShadow"); |
lightHighlight = UIManager.getColor("InternalFrame.borderHighlight"); |
382 |
highlight = defaults.getColor("InternalFrame.borderLight"); |
line = UIManager.getColor("InternalFrame.borderColor"); |
|
lightHighlight = defaults.getColor("InternalFrame.borderHighlight"); |
|
|
line = defaults.getColor("InternalFrame.borderColor"); |
|
383 |
|
|
384 |
return new BorderUIResource.CompoundBorderUIResource( |
return new BorderUIResource.CompoundBorderUIResource( |
385 |
/* outer border */ |
/* outer border */ |