APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.metal

public Class MetalLookAndFeel

extends BasicLookAndFeel
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.awt.Color, .Component, .Container, .Frame, .Insets, .Toolkit, .Window, java.beans.PropertyChangeEvent, .PropertyChangeListener, java.lang.ref.ReferenceQueue, .WeakReference, javax.swing.ButtonModel, .DefaultButtonModel, .Icon, .ImageIcon, .JComponent, .JDialog, .JFrame, .JRootPane, .JTextField, .JToggleButton, .LayoutStyle, .LookAndFeel, .SwingConstants, .SwingUtilities, .UIDefaults, .UIManager, javax.swing.plaf.BorderUIResource, .ColorUIResource, .FontUIResource, .InsetsUIResource, .UIResource, javax.swing.plaf.basic.BasicLookAndFeel, javax.swing.text.DefaultEditorKit, sun.awt.OSInfo, .SunToolkit, sun.swing.DefaultLayoutStyle, .SwingAccessor, .SwingUtilities2

The Java Look and Feel, otherwise known as Metal.

Each of the ComponentUIs 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 JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
Steve Wilson
See Also
MetalTheme, DefaultMetalTheme, OceanTheme

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class
MetalLookAndFeel.FontActiveValue

FontActiveValue redirects to the appropriate metal theme method.

private static class

Field Summary

Modifier and TypeField and Description
private static boolean
checkedSystemFontSettings

Set to true first time we've checked swing.useSystemFontSettings.

private static boolean
checkedWindows

True if checked for windows yet.

private static MetalTheme
private static boolean
isWindows

True if running on Windows.

private static boolean
pack-priv static ReferenceQueue<LookAndFeel>
private static boolean
useSystemFonts

True indicates we should use system fonts, unless the developer has specified otherwise with Application.useSystemFontSettings.

Constructor Summary

AccessConstructor and Description
public
MetalLookAndFeel()

Constructs a MetalLookAndFeel.

Method Summary

Modifier and TypeMethod and Description
protected void
createDefaultTheme()

Ensures the current MetalTheme is non-null.

pack-priv static void
public static ColorUIResource

Returns:

the separator accelerator foreground color
getAcceleratorForeground
()

Returns the accelerator foreground color of the current theme.

public static ColorUIResource

Returns:

the accelerator selected foreground color
getAcceleratorSelectedForeground
()

Returns the accelerator selected foreground color of the current theme.

public static ColorUIResource

Returns:

the black color
getBlack
()

Returns the black color of the current theme.

public static ColorUIResource

Returns:

the control color
getControl
()

Returns the control color of the current theme.

public static ColorUIResource

Returns:

the control dark shadow color
getControlDarkShadow
()

Returns the control dark shadow color of the current theme.

public static ColorUIResource

Returns:

the control disabled color
getControlDisabled
()

Returns the control disabled color of the current theme.

public static ColorUIResource

Returns:

the control highlight color
getControlHighlight
()

Returns the control highlight color of the current theme.

public static ColorUIResource

Returns:

the control info color
getControlInfo
()

Returns the control info color of the current theme.

public static ColorUIResource

Returns:

the control shadow color
getControlShadow
()

Returns the control shadow color of the current theme.

public static ColorUIResource

Returns:

the control text color
getControlTextColor
()

Returns the control text color of the current theme.

public static FontUIResource

Returns:

the control text font
getControlTextFont
()

Returns the control text font of the current theme.

public static MetalTheme

Returns:

the current theme
getCurrentTheme
()

Return the theme currently being used by MetalLookAndFeel.

public UIDefaults

Returns:

the look and feel defaults
getDefaults
()

Overrides javax.swing.plaf.basic.BasicLookAndFeel.getDefaults.

Returns the look and feel defaults.

public String

Returns:

a short description for the look and feel
getDescription
()

Implements abstract javax.swing.LookAndFeel.getDescription.

Returns a short description of this look and feel.

public static ColorUIResource

Returns:

the desktop color
getDesktopColor
()

Returns the desktop color of the current theme.

public Icon

Returns:

Disabled icon, or null if a suitable Icon can not be generated.
getDisabledIcon
(JComponent
JComponent that will display the Icon, may be null
component
,
Icon
Icon to generate disable icon from.
icon
)

Overrides javax.swing.LookAndFeel.getDisabledIcon.

Returns an Icon with a disabled appearance.

public Icon

Returns:

Disabled and Selected icon, or null if a suitable Icon can not be generated.
getDisabledSelectedIcon
(JComponent
JComponent that will display the Icon, may be null
component
,
Icon
Icon to generate disabled and selected icon from.
icon
)

Overrides javax.swing.LookAndFeel.getDisabledSelectedIcon.

Returns an Icon for use by disabled components that are also selected.

public static ColorUIResource

Returns:

the focus color
getFocusColor
()

Returns the focus color of the current theme.

public static ColorUIResource

Returns:

the highlighted text color
getHighlightedTextColor
()

Returns the highlighted text color of the current theme.

public String

Returns:

the identifier of this look and feel
getID
()

Implements abstract javax.swing.LookAndFeel.getID.

Returns an identifier for this look and feel.

public static ColorUIResource

Returns:

the inactive control text color
getInactiveControlTextColor
()

Returns the inactive control text color of the current theme.

public static ColorUIResource

Returns:

the inactive system text color
getInactiveSystemTextColor
()

Returns the inactive system text color of the current theme.

public LayoutStyle

Returns:

LayoutStyle implementing the Java look and feel design guidelines
getLayoutStyle
()

Overrides javax.swing.LookAndFeel.getLayoutStyle.

Returns a LayoutStyle implementing the Java look and feel design guidelines.

public static ColorUIResource

Returns:

the menu background color
getMenuBackground
()

Returns the menu background color of the current theme.

public static ColorUIResource

Returns:

the menu disabled foreground color
getMenuDisabledForeground
()

Returns the menu disabled foreground color of the current theme.

public static ColorUIResource

Returns:

the menu foreground color
getMenuForeground
()

Returns the menu foreground color of the current theme.

public static ColorUIResource

Returns:

the menu selected background color
getMenuSelectedBackground
()

Returns the menu selected background color of the current theme.

public static ColorUIResource

Returns:

the menu selected foreground color
getMenuSelectedForeground
()

Returns the menu selected foreground color of the current theme.

public static FontUIResource

Returns:

the menu text font
getMenuTextFont
()

Returns the menu text font of the current theme.

public String

Returns:

the name of this look and feel
getName
()

Implements abstract javax.swing.LookAndFeel.getName.

Returns the name of this look and feel.

public static ColorUIResource

Returns:

the primary control color
getPrimaryControl
()

Returns the primary control color of the current theme.

public static ColorUIResource

Returns:

the primary control dark shadow color
getPrimaryControlDarkShadow
()

Returns the primary control dark shadow color of the current theme.

public static ColorUIResource

Returns:

the primary control highlight color
getPrimaryControlHighlight
()

Returns the primary control highlight color of the current theme.

public static ColorUIResource

Returns:

the primary control info color
getPrimaryControlInfo
()

Returns the primary control info color of the current theme.

public static ColorUIResource

Returns:

the primary control shadow color
getPrimaryControlShadow
()

Returns the primary control shadow color of the current theme.

public static ColorUIResource

Returns:

the separator background color
getSeparatorBackground
()

Returns the separator background color of the current theme.

public static ColorUIResource

Returns:

the separator foreground color
getSeparatorForeground
()

Returns the separator foreground color of the current theme.

public static FontUIResource

Returns:

the sub-text font
getSubTextFont
()

Returns the sub-text font of the current theme.

public boolean

Returns:

true
getSupportsWindowDecorations
()

Overrides javax.swing.LookAndFeel.getSupportsWindowDecorations.

Returns true; metal can provide Window decorations.

public static ColorUIResource

Returns:

the system text color
getSystemTextColor
()

Returns the system text color of the current theme.

public static FontUIResource

Returns:

the system text font
getSystemTextFont
()

Returns the system text font of the current theme.

public static ColorUIResource

Returns:

the text highlight color
getTextHighlightColor
()

Returns the text highlight color of the current theme.

public static ColorUIResource

Returns:

the user text color
getUserTextColor
()

Returns the user text color of the current theme.

public static FontUIResource

Returns:

the user text font
getUserTextFont
()

Returns the user text font of the current theme.

public static ColorUIResource

Returns:

the white color
getWhite
()

Returns the white color of the current theme.

public static ColorUIResource

Returns:

the window background color
getWindowBackground
()

Returns the window background color of the current theme.

public static ColorUIResource

Returns:

the window title background color
getWindowTitleBackground
()

Returns the window title background color of the current theme.

public static FontUIResource

Returns:

the window title font
getWindowTitleFont
()

Returns the window title font of the current theme.

public static ColorUIResource

Returns:

the window title foreground color
getWindowTitleForeground
()

Returns the window title foreground color of the current theme.

public static ColorUIResource

Returns:

the window title inactive background color
getWindowTitleInactiveBackground
()

Returns the window title inactive background color of the current theme.

public static ColorUIResource

Returns:

the window title inactive foreground color
getWindowTitleInactiveForeground
()

Returns the window title inactive foreground color of the current theme.

protected void
initClassDefaults(UIDefaults
the UIDefaults instance the entries are added to
table
)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.initClassDefaults.

Populates table with mappings from uiClassID to the fully qualified name of the ui class.

protected void
initComponentDefaults(UIDefaults
the UIDefaults to add the values to
table
)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults.

Populates table with the defaults for metal.

private void
initResourceBundle(UIDefaults table)

Hides javax.swing.plaf.basic.BasicLookAndFeel.initResourceBundle.

Initialize the defaults table with the name of the ResourceBundle used for getting localized defaults.

protected void
initSystemColorDefaults(UIDefaults
the UIDefaults object the values are added to
table
)

Overrides javax.swing.plaf.basic.BasicLookAndFeel.initSystemColorDefaults.

Populates table with system colors.

public boolean

Returns:

false
isNativeLookAndFeel
()

Implements abstract javax.swing.LookAndFeel.isNativeLookAndFeel.

Returns false; MetalLookAndFeel is not a native look and feel.

public boolean

Returns:

true
isSupportedLookAndFeel
()

Implements abstract javax.swing.LookAndFeel.isSupportedLookAndFeel.

Returns true; MetalLookAndFeel can be run on any platform.

pack-priv static boolean
isWindows()

Returns true if running on Windows.

public void
provideErrorFeedback(Component component)

Overrides javax.swing.LookAndFeel.provideErrorFeedback.

Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus.

public static void
setCurrentTheme(MetalTheme
the theme to use
theme
)

Set the theme used by MetalLookAndFeel.

private static boolean
useHighContrastTheme()

Returns true if the high contrast theme should be used as the default theme.

pack-priv static boolean
useSystemFonts()

Returns true if system fonts should be used, this is only useful for windows.

pack-priv static boolean
usingOcean()

Returns true if we're using the Ocean Theme.

Inherited from javax.swing.plaf.basic.BasicLookAndFeel:
createAudioActiongetAudioActionMapinitializeloadSystemColorsplaySounduninitialize