Java Reference
In-Depth Information
■
Note
When creating your own look and feel, be sure to copy or create icons for the
JOptionPane
pop-up
windows. Unless you're customizing Ocean, these icons should be named
Error.gif
,
Inform.gif
,
Question.gif
, and
Warn.gif
, and they belong in the
icons
directory under the directory where the look
and feel class file exists.
Working with Metal Themes
The Metal look and feel class (
javax.swing.plaf.metal.MetalLookAndFeel
) provides the means
to define
themes
to describe the default settings for the colors, fonts, and all the
UIDefaults
managed by the
UIManager
. By allowing users to change themes, they can get preferred colora-
tion or font sizes with minimal work from the developer. By developing corporate themes, you
can easily customize an interface without creating new look and feel classes or manually inserting
new settings into current
UIDefaults
.
MetalTheme Class
Table 20-10 lists the 49 different properties that are available through the
MetalTheme
class.
The various
primary
and
secondary
properties are abstract and must be implemented in a
subclass. Of the remaining properties, the six whose names end with
Font
—
controlTextFont
,
menuTextFont
,
subTextFont
,
systemTextFont
,
userTextFont
, and
windowTextFont
—are also
abstract and must be implemented by a subclass. The remaining properties, by default, reuse
one of the 11
primary
/
secondary
values (or black and white) for their settings.
Table 20-10.
MetalTheme Properties
Property Name
Data Type
Access
acceleratorForeground
ColorUIResource
Read-only
acceleratorSelectedForeground
ColorUIResource
Read-only
black
ColorUIResource
Read-only
control
ColorUIResource
Read-only
controlDarkShadow
ColorUIResource
Read-only
controlDisabled
ColorUIResource
Read-only
controlHighlight
ColorUIResource
Read-only
controlInfo
ColorUIResource
Read-only
controlShadow
ColorUIResource
Read-only
controlTextColor
ColorUIResource
Read-only
controlTextFont
FontUIResource
Read-only