Each of the
ComponentUI s provided by
MetalLookAndFeel derives its behavior from the defaults
table. Unless otherwise noted each of the
ComponentUI implementations in this package document the set of defaults they
use. Unless otherwise noted the defaults are installed at the time
installUI is invoked, and follow the recommendations
outlined in
LookAndFeel for installing defaults.
MetalLookAndFeel derives it's color palette and fonts from
MetalTheme . The default theme is
OceanTheme . The theme
can be changed using the
setCurrentTheme method, refer to it
for details on changing the theme. Prior to 1.5 the default
theme was
DefaultMetalTheme . The system property
"swing.metalTheme" can be set to
"steel" to indicate
the default should be
DefaultMetalTheme .
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see
java.beans.XMLEncoder .
See Also:MetalTheme See Also:DefaultMetalTheme See Also:OceanTheme version: @(#)MetalLookAndFeel.java 1.213 07/06/07 author: Steve Wilson
getDisabledIcon(JComponent component, Icon icon) Returns an Icon with a disabled appearance.
This method is used to generate a disabled Icon when
one has not been specified.
Returns the accelerator foreground color of the current theme. This is
a cover method for
getCurrentTheme().getAcceleratorForeground() .
the separator accelerator foreground color See Also:MetalTheme
Returns the accelerator selected foreground color of the
current theme. This is a cover method for
getCurrentTheme().getAcceleratorSelectedForeground() .
the accelerator selected foreground color See Also:MetalTheme
Returns the control dark shadow color of the current theme. This is a
cover method for
getCurrentTheme().getControlDarkShadow() .
the control dark shadow color See Also:MetalTheme
Returns the control disabled color of the current theme. This is a
cover method for
getCurrentTheme().getControlDisabled() .
the control disabled color See Also:MetalTheme
Returns the control highlight color of the current theme. This is a
cover method for
getCurrentTheme().getControlHighlight() .
the control highlight color See Also:MetalTheme
Returns the control info color of the current theme. This is a
cover method for
getCurrentTheme().getControlInfo() .
the control info color See Also:MetalTheme
Returns the control shadow color of the current theme. This is a
cover method for
getCurrentTheme().getControlShadow() .
the control shadow color See Also:MetalTheme
Returns the control text color of the current theme. This is a
cover method for
getCurrentTheme().getControlTextColor() .
the control text color See Also:MetalTheme
Returns the control text font of the current theme. This is a
cover method for
getCurrentTheme().getControlTextColor() .
the control text font See Also:MetalTheme
Return the theme currently being used by MetalLookAndFeel.
If the current theme is
null , the default theme is created.
the current theme See Also:MetalLookAndFeel.setCurrentTheme since: 1.5
Returns the look and feel defaults. This invokes, in order,
createDefaultTheme() ,
super.getDefaults() and
getCurrentTheme().addCustomEntriesToTable(table) .
Returns an Icon with a disabled appearance.
This method is used to generate a disabled Icon when
one has not been specified. For example, if you create a
JButton and only specify an Icon via
setIcon this method will be called to generate the
disabled Icon. If null is passed as icon
this method returns null.
Some look and feels might not render the disabled Icon, in which
case they will ignore this.
Parameters: component - JComponent that will display the Icon, may be null Parameters: icon - Icon to generate disable icon from. Disabled icon, or null if a suitable Icon can not begenerated. since: 1.5
Returns an Icon for use by disabled
components that are also selected. This method is used to generate an
Icon for components that are in both the disabled and
selected states but do not have a specific Icon for this
state. For example, if you create a JButton and only
specify an Icon via setIcon this method
will be called to generate the disabled and selected
Icon. If null is passed as icon this method
returns null.
Some look and feels might not render the disabled and selected Icon,
in which case they will ignore this.
Parameters: component - JComponent that will display the Icon, may be null Parameters: icon - Icon to generate disabled and selected icon from. Disabled and Selected icon, or null if a suitable Icon can notbe generated. since: 1.5
Returns the highlighted text color of the current theme. This is a
cover method for
getCurrentTheme().getHighlightedTextColor() .
the highlighted text color See Also:MetalTheme
Returns the inactive control text color of the current theme. This is a
cover method for
getCurrentTheme().getInactiveControlTextColor() .
the inactive control text color See Also:MetalTheme
Returns the inactive system text color of the current theme. This is a
cover method for
getCurrentTheme().getInactiveSystemTextColor() .
the inactive system text color See Also:MetalTheme
Returns the menu background color of the current theme. This is
a cover method for
getCurrentTheme().getMenuBackground() .
the menu background color See Also:MetalTheme
Returns the menu disabled foreground color of the current theme. This is
a cover method for
getCurrentTheme().getMenuDisabledForeground() .
the menu disabled foreground color See Also:MetalTheme
Returns the menu foreground color of the current theme. This is
a cover method for
getCurrentTheme().getMenuForeground() .
the menu foreground color See Also:MetalTheme
Returns the menu selected background color of the current theme. This is
a cover method for
getCurrentTheme().getMenuSelectedBackground() .
the menu selected background color See Also:MetalTheme
Returns the menu selected foreground color of the current theme. This is
a cover method for
getCurrentTheme().getMenuSelectedForeground() .
the menu selected foreground color See Also:MetalTheme
Returns the menu text font of the current theme. This is a
cover method for
getCurrentTheme().getMenuTextFont() .
the menu text font See Also:MetalTheme
Returns the primary control color of the current theme. This is a
cover method for
getCurrentTheme().getPrimaryControl() .
the primary control color See Also:MetalTheme
Returns the primary control dark shadow color of the current
theme. This is a cover method for
getCurrentTheme().getPrimaryControlDarkShadow() .
the primary control dark shadow color See Also:MetalTheme
Returns the primary control highlight color of the current
theme. This is a cover method for
getCurrentTheme().getPrimaryControlHighlight() .
the primary control highlight color See Also:MetalTheme
Returns the primary control info color of the current theme. This is a
cover method for
getCurrentTheme().getPrimaryControlInfo() .
the primary control info color See Also:MetalTheme
Returns the primary control shadow color of the current theme. This is a
cover method for
getCurrentTheme().getPrimaryControlShadow() .
the primary control shadow color See Also:MetalTheme
Returns the separator background color of the current theme. This is
a cover method for
getCurrentTheme().getSeparatorBackground() .
the separator background color See Also:MetalTheme
Returns the separator foreground color of the current theme. This is
a cover method for
getCurrentTheme().getSeparatorForeground() .
the separator foreground color See Also:MetalTheme
Returns the system text color of the current theme. This is a
cover method for
getCurrentTheme().getSystemTextColor() .
the system text color See Also:MetalTheme
Returns the sytem text font of the current theme. This is a
cover method for
getCurrentTheme().getSystemTextFont() .
the system text font See Also:MetalTheme
Returns the text highlight color of the current theme. This is a
cover method for
getCurrentTheme().getTextHighlightColor() .
the text highlight color See Also:MetalTheme
Returns the user text color of the current theme. This is a
cover method for
getCurrentTheme().getUserTextColor() .
the user text color See Also:MetalTheme
Returns the user text font of the current theme. This is a
cover method for
getCurrentTheme().getUserTextFont() .
the user text font See Also:MetalTheme
Returns the window background color of the current theme. This is a
cover method for
getCurrentTheme().getWindowBackground() .
the window background color See Also:MetalTheme
Returns the window title background color of the current
theme. This is a cover method for
getCurrentTheme().getWindowTitleBackground() .
the window title background color See Also:MetalTheme
Returns the window title font of the current theme. This is a
cover method for
getCurrentTheme().getWindowTitleFont() .
the window title font See Also:MetalTheme
Returns the window title foreground color of the current
theme. This is a cover method for
getCurrentTheme().getWindowTitleForeground() .
the window title foreground color See Also:MetalTheme
Returns the window title inactive background color of the current
theme. This is a cover method for
getCurrentTheme().getWindowTitleInactiveBackground() .
the window title inactive background color See Also:MetalTheme
Returns the window title inactive foreground color of the current
theme. This is a cover method for
getCurrentTheme().getWindowTitleInactiveForeground() .
the window title inactive foreground color See Also:MetalTheme
Populates
table with mappings from
uiClassID to
the fully qualified name of the ui class.
MetalLookAndFeel registers an entry for each of the classes in
the package
javax.swing.plaf.metal that are named
MetalXXXUI. The string
XXX is one of Swing's uiClassIDs. For
the
uiClassIDs that do not have a class in metal, the
corresponding class in
javax.swing.plaf.basic is
used. For example, metal does not have a class named
"MetalColorChooserUI" , as such,
javax.swing.plaf.basic.BasicColorChooserUI is used.
Parameters: table - the UIDefaults instance the entries areadded to throws: NullPointerException - if table is null See Also:javax.swing.plaf.basic.BasicLookAndFeel.initClassDefaults
Populates
table with system colors. The following values are
added to
table :
Key
Value
"desktop"
theme.getDesktopColor()
"activeCaption"
theme.getWindowTitleBackground()
"activeCaptionText"
theme.getWindowTitleForeground()
"activeCaptionBorder"
theme.getPrimaryControlShadow()
"inactiveCaption"
theme.getWindowTitleInactiveBackground()
"inactiveCaptionText"
theme.getWindowTitleInactiveForeground()
"inactiveCaptionBorder"
theme.getControlShadow()
"window"
theme.getWindowBackground()
"windowBorder"
theme.getControl()
"windowText"
theme.getUserTextColor()
"menu"
theme.getMenuBackground()
"menuText"
theme.getMenuForeground()
"text"
theme.getWindowBackground()
"textText"
theme.getUserTextColor()
"textHighlight"
theme.getTextHighlightColor()
"textHighlightText"
theme.getHighlightedTextColor()
"textInactiveText"
theme.getInactiveSystemTextColor()
"control"
theme.getControl()
"controlText"
theme.getControlTextColor()
"controlHighlight"
theme.getControlHighlight()
"controlLtHighlight"
theme.getControlHighlight()
"controlShadow"
theme.getControlShadow()
"controlDkShadow"
theme.getControlDarkShadow()
"scrollbar"
theme.getControl()
"info"
theme.getPrimaryControl()
"infoText"
theme.getPrimaryControlInfo()
The value
theme corresponds to the current
MetalTheme .
Parameters: table - the UIDefaults object the values are added to throws: NullPointerException - if table is null
After the theme is set,
MetalLookAndFeel needs to be
re-installed and the uis need to be recreated. The following
shows how to do this:
MetalLookAndFeel.setCurrentTheme(theme);
// re-install the Metal Look and Feel
UIManager.setLookAndFeel(new MetalLookAndFeel());
// Update the ComponentUIs for all Components. This
// needs to be invoked for all windows.
SwingUtilities.updateComponentTreeUI(rootComponent);