
Make Quick Look and Feel Changes #86
Chapter 11, Native Integration and Packaging
|
437
HACK
Some components even have borders. Menu items have borders but they are
turned off by default. You need to set an extra boolean to make a new bor-
der show up, as in Figure 11-14.
Border border = BorderFactory.createEtchedBorder(
EtchedBorder.LOWERED);
UIManager.put("MenuItem.border", border);
UIManager.put("MenuItem.borderPainted", new Boolean(true));
Use System Colors
The UIManager lets you change any color in your application to whatever you
want. Now, what if you wanted to create a theme that matched the native
operating system closer? You could hardcode some color values for each OS,
but most windowing systems also let their users customize their colors.
Hardcoded values wouldn’t take those dynamic colors into account. Fortu-
nately, AWT provides a way out: the
SystemColor class.
Figure 11-13. A JTextField with large insets
Figure 11-14. Menu items with etched borders