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

public abstract Class MetalTheme

extends Object
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.metal.DefaultMetalTheme
Imports
javax.swing.plaf.*, javax.swing.*

MetalTheme provides the color palette and fonts used by the Java Look and Feel.

MetalTheme is abstract, see DefaultMetalTheme and OceanTheme for concrete implementations.

MetalLookAndFeel maintains the current theme that the the ComponentUI implementations for metal use. Refer to MetalLookAndFeel.setCurrentTheme(MetalTheme) for details on changing the current theme.

MetalTheme provides a number of public methods for getting colors. These methods are implemented in terms of a handful of protected abstract methods. A subclass need only override the protected abstract methods (getPrimary1, getPrimary2, getPrimary3, getSecondary1, getSecondary2, and getSecondary3); although a subclass may override the other public methods for more control over the set of colors that are used.

Concrete implementations of MetalTheme must return non-null values from all methods. While the behavior of returning null is not specified, returning null will result in incorrect behavior.

It is strongly recommended that subclasses return completely opaque colors. To do otherwise may result in rendering problems, such as visual garbage.

Author
Steve Wilson
See Also
DefaultMetalTheme, OceanTheme, MetalLookAndFeel#setCurrentTheme

Field Summary

Modifier and TypeField and Description
private static ColorUIResource
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static ColorUIResource
pack-priv static final int

Constructor Summary

AccessConstructor and Description
protected
MetalTheme()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public void
addCustomEntriesToTable(UIDefaults
the UIDefaults to add the values to
table
)

Adds values specific to this theme to the defaults table.

public ColorUIResource

Returns:

the accelerator foreground color
getAcceleratorForeground
()

Returns the accelerator foreground color.

public ColorUIResource

Returns:

the accelerator selected foreground color
getAcceleratorSelectedForeground
()

Returns the accelerator selected foreground color.

protected ColorUIResource

Returns:

the black color
getBlack
()

Returns the black color.

public ColorUIResource

Returns:

the control color
getControl
()

Returns the control color.

public ColorUIResource

Returns:

the control dark shadow color
getControlDarkShadow
()

Returns the control dark shadow color.

public ColorUIResource

Returns:

the control disabled color
getControlDisabled
()

Returns the control disabled color.

public ColorUIResource

Returns:

the control highlight color
getControlHighlight
()

Returns the control highlight color.

public ColorUIResource

Returns:

the control info color
getControlInfo
()

Returns the control info color.

public ColorUIResource

Returns:

the control shadow color
getControlShadow
()

Returns the control shadow color.

public ColorUIResource

Returns:

the control text color
getControlTextColor
()

Returns the control text color.

public abstract FontUIResource

Returns:

the control text font
getControlTextFont
()

Returns the control text font.

public ColorUIResource

Returns:

the desktop color
getDesktopColor
()

Returns the desktop color.

public ColorUIResource

Returns:

the focus color
getFocusColor
()

Returns the focus color.

public ColorUIResource

Returns:

the highlighted text color
getHighlightedTextColor
()

Returns the highlighted text color.

public ColorUIResource

Returns:

the inactive control text color
getInactiveControlTextColor
()

Returns the inactive control text color.

public ColorUIResource

Returns:

the inactive system text color
getInactiveSystemTextColor
()

Returns the inactive system text color.

public ColorUIResource

Returns:

the menu background color
getMenuBackground
()

Returns the menu background color.

public ColorUIResource

Returns:

the menu disabled foreground color
getMenuDisabledForeground
()

Returns the menu disabled foreground color.

public ColorUIResource

Returns:

the menu foreground color
getMenuForeground
()

Returns the menu foreground color.

public ColorUIResource

Returns:

the menu selected background color
getMenuSelectedBackground
()

Returns the menu selected background color.

public ColorUIResource

Returns:

the menu selected foreground color
getMenuSelectedForeground
()

Returns the menu selected foreground color.

public abstract FontUIResource

Returns:

the menu text font
getMenuTextFont
()

Returns the menu text font.

public abstract String

Returns:

the name of this theme
getName
()

Returns the name of this theme.

protected abstract ColorUIResource

Returns:

the primary 1 color
getPrimary1
()

Returns the primary 1 color.

protected abstract ColorUIResource

Returns:

the primary 2 color
getPrimary2
()

Returns the primary 2 color.

protected abstract ColorUIResource

Returns:

the primary 3 color
getPrimary3
()

Returns the primary 3 color.

public ColorUIResource

Returns:

the primary control color
getPrimaryControl
()

Returns the primary control color.

public ColorUIResource

Returns:

the primary control dark shadow color
getPrimaryControlDarkShadow
()

Returns the primary control dark shadow color.

public ColorUIResource

Returns:

the primary control highlight color
getPrimaryControlHighlight
()

Returns the primary control highlight color.

public ColorUIResource

Returns:

the primary control info color
getPrimaryControlInfo
()

Returns the primary control info color.

public ColorUIResource

Returns:

the primary control shadow color
getPrimaryControlShadow
()

Returns the primary control shadow color.

protected abstract ColorUIResource

Returns:

the secondary 1 color
getSecondary1
()

Returns the secondary 1 color.

protected abstract ColorUIResource

Returns:

the secondary 2 color
getSecondary2
()

Returns the secondary 2 color.

protected abstract ColorUIResource

Returns:

the secondary 3 color
getSecondary3
()

Returns the secondary 3 color.

public ColorUIResource

Returns:

the separator background color
getSeparatorBackground
()

Returns the separator background color.

public ColorUIResource

Returns:

the separator foreground color
getSeparatorForeground
()

Returns the separator foreground color.

public abstract FontUIResource

Returns:

the sub-text font
getSubTextFont
()

Returns the sub-text font.

public ColorUIResource

Returns:

the system text color
getSystemTextColor
()

Returns the system text color.

public abstract FontUIResource

Returns:

the system text font
getSystemTextFont
()

Returns the system text font.

public ColorUIResource

Returns:

the text highlight color
getTextHighlightColor
()

Returns the text highlight color.

public ColorUIResource

Returns:

the user text color
getUserTextColor
()

Returns the user text color.

public abstract FontUIResource

Returns:

the user text font
getUserTextFont
()

Returns the user text font.

protected ColorUIResource

Returns:

the white color
getWhite
()

Returns the white color.

public ColorUIResource

Returns:

the window background color
getWindowBackground
()

Returns the window background color.

public ColorUIResource

Returns:

the window title background color
getWindowTitleBackground
()

Returns the window title background color.

public abstract FontUIResource

Returns:

the window title font
getWindowTitleFont
()

Returns the window title font.

public ColorUIResource

Returns:

the window title foreground color
getWindowTitleForeground
()

Returns the window title foreground color.

public ColorUIResource

Returns:

the window title inactive background color
getWindowTitleInactiveBackground
()

Returns the window title inactive background color.

public ColorUIResource

Returns:

the window title inactive foreground color
getWindowTitleInactiveForeground
()

Returns the window title inactive foreground color.

pack-priv void
install()

This is invoked when a MetalLookAndFeel is installed and about to start using this theme.

pack-priv boolean
isSystemTheme()

Returns true if this is a theme provided by the core platform.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blackback to summary
private static ColorUIResource black
CONTROL_TEXT_FONTback to summary
pack-priv static final int CONTROL_TEXT_FONT
SUB_TEXT_FONTback to summary
pack-priv static final int SUB_TEXT_FONT
SYSTEM_TEXT_FONTback to summary
pack-priv static final int SYSTEM_TEXT_FONT
USER_TEXT_FONTback to summary
pack-priv static final int USER_TEXT_FONT
whiteback to summary
pack-priv static ColorUIResource white
WINDOW_TITLE_FONTback to summary
pack-priv static final int WINDOW_TITLE_FONT

Constructor Detail

MetalThemeback to summary
protected MetalTheme()

Constructor for subclasses to call.

Method Detail

addCustomEntriesToTableback to summary
public void addCustomEntriesToTable(UIDefaults table)

Adds values specific to this theme to the defaults table. This method is invoked when the look and feel defaults are obtained from MetalLookAndFeel.

This implementation does nothing; it is provided for subclasses that wish to customize the defaults table.

Parameters
table:UIDefaults

the UIDefaults to add the values to

See Also
MetalLookAndFeel#getDefaults
getAcceleratorForegroundback to summary
public ColorUIResource getAcceleratorForeground()

Returns the accelerator foreground color. This returns the value of getPrimary1().

Returns:ColorUIResource

the accelerator foreground color

getAcceleratorSelectedForegroundback to summary
public ColorUIResource getAcceleratorSelectedForeground()

Returns the accelerator selected foreground color. This returns the value of getBlack().

Returns:ColorUIResource

the accelerator selected foreground color

getBlackback to summary
protected ColorUIResource getBlack()

Returns the black color. This returns opaque black (0xFF000000).

Returns:ColorUIResource

the black color

getControlback to summary
public ColorUIResource getControl()

Returns the control color. This returns the value of getSecondary3().

Returns:ColorUIResource

the control color

getControlDarkShadowback to summary
public ColorUIResource getControlDarkShadow()

Returns the control dark shadow color. This returns the value of getSecondary1().

Returns:ColorUIResource

the control dark shadow color

getControlDisabledback to summary
public ColorUIResource getControlDisabled()

Returns the control disabled color. This returns the value of getSecondary2().

Returns:ColorUIResource

the control disabled color

getControlHighlightback to summary
public ColorUIResource getControlHighlight()

Returns the control highlight color. This returns the value of getWhite().

Returns:ColorUIResource

the control highlight color

getControlInfoback to summary
public ColorUIResource getControlInfo()

Returns the control info color. This returns the value of getBlack().

Returns:ColorUIResource

the control info color

getControlShadowback to summary
public ColorUIResource getControlShadow()

Returns the control shadow color. This returns the value of getSecondary2().

Returns:ColorUIResource

the control shadow color

getControlTextColorback to summary
public ColorUIResource getControlTextColor()

Returns the control text color. This returns the value of getControlInfo().

Returns:ColorUIResource

the control text color

getControlTextFontback to summary
public abstract FontUIResource getControlTextFont()

Returns the control text font.

Returns:FontUIResource

the control text font

getDesktopColorback to summary
public ColorUIResource getDesktopColor()

Returns the desktop color. This returns the value of getPrimary2().

Returns:ColorUIResource

the desktop color

getFocusColorback to summary
public ColorUIResource getFocusColor()

Returns the focus color. This returns the value of getPrimary2().

Returns:ColorUIResource

the focus color

getHighlightedTextColorback to summary
public ColorUIResource getHighlightedTextColor()

Returns the highlighted text color. This returns the value of getControlTextColor().

Returns:ColorUIResource

the highlighted text color

getInactiveControlTextColorback to summary
public ColorUIResource getInactiveControlTextColor()

Returns the inactive control text color. This returns the value of getControlDisabled().

Returns:ColorUIResource

the inactive control text color

getInactiveSystemTextColorback to summary
public ColorUIResource getInactiveSystemTextColor()

Returns the inactive system text color. This returns the value of getSecondary2().

Returns:ColorUIResource

the inactive system text color

getMenuBackgroundback to summary
public ColorUIResource getMenuBackground()

Returns the menu background color. This returns the value of getSecondary3().

Returns:ColorUIResource

the menu background color

getMenuDisabledForegroundback to summary
public ColorUIResource getMenuDisabledForeground()

Returns the menu disabled foreground color. This returns the value of getSecondary2().

Returns:ColorUIResource

the menu disabled foreground color

getMenuForegroundback to summary
public ColorUIResource getMenuForeground()

Returns the menu foreground color. This returns the value of getBlack().

Returns:ColorUIResource

the menu foreground color

getMenuSelectedBackgroundback to summary
public ColorUIResource getMenuSelectedBackground()

Returns the menu selected background color. This returns the value of getPrimary2().

Returns:ColorUIResource

the menu selected background color

getMenuSelectedForegroundback to summary
public ColorUIResource getMenuSelectedForeground()

Returns the menu selected foreground color. This returns the value of getBlack().

Returns:ColorUIResource

the menu selected foreground color

getMenuTextFontback to summary
public abstract FontUIResource getMenuTextFont()

Returns the menu text font.

Returns:FontUIResource

the menu text font

getNameback to summary
public abstract String getName()

Returns the name of this theme.

Returns:String

the name of this theme

getPrimary1back to summary
protected abstract ColorUIResource getPrimary1()

Returns the primary 1 color.

Returns:ColorUIResource

the primary 1 color

getPrimary2back to summary
protected abstract ColorUIResource getPrimary2()

Returns the primary 2 color.

Returns:ColorUIResource

the primary 2 color

getPrimary3back to summary
protected abstract ColorUIResource getPrimary3()

Returns the primary 3 color.

Returns:ColorUIResource

the primary 3 color

getPrimaryControlback to summary
public ColorUIResource getPrimaryControl()

Returns the primary control color. This returns the value of getPrimary3().

Returns:ColorUIResource

the primary control color

getPrimaryControlDarkShadowback to summary
public ColorUIResource getPrimaryControlDarkShadow()

Returns the primary control dark shadow color. This returns the value of getPrimary1().

Returns:ColorUIResource

the primary control dark shadow color

getPrimaryControlHighlightback to summary
public ColorUIResource getPrimaryControlHighlight()

Returns the primary control highlight color. This returns the value of getWhite().

Returns:ColorUIResource

the primary control highlight color

getPrimaryControlInfoback to summary
public ColorUIResource getPrimaryControlInfo()

Returns the primary control info color. This returns the value of getBlack().

Returns:ColorUIResource

the primary control info color

getPrimaryControlShadowback to summary
public ColorUIResource getPrimaryControlShadow()

Returns the primary control shadow color. This returns the value of getPrimary2().

Returns:ColorUIResource

the primary control shadow color

getSecondary1back to summary
protected abstract ColorUIResource getSecondary1()

Returns the secondary 1 color.

Returns:ColorUIResource

the secondary 1 color

getSecondary2back to summary
protected abstract ColorUIResource getSecondary2()

Returns the secondary 2 color.

Returns:ColorUIResource

the secondary 2 color

getSecondary3back to summary
protected abstract ColorUIResource getSecondary3()

Returns the secondary 3 color.

Returns:ColorUIResource

the secondary 3 color

getSeparatorBackgroundback to summary
public ColorUIResource getSeparatorBackground()

Returns the separator background color. This returns the value of getWhite().

Returns:ColorUIResource

the separator background color

getSeparatorForegroundback to summary
public ColorUIResource getSeparatorForeground()

Returns the separator foreground color. This returns the value of getPrimary1().

Returns:ColorUIResource

the separator foreground color

getSubTextFontback to summary
public abstract FontUIResource getSubTextFont()

Returns the sub-text font.

Returns:FontUIResource

the sub-text font

getSystemTextColorback to summary
public ColorUIResource getSystemTextColor()

Returns the system text color. This returns the value of getBlack().

Returns:ColorUIResource

the system text color

getSystemTextFontback to summary
public abstract FontUIResource getSystemTextFont()

Returns the system text font.

Returns:FontUIResource

the system text font

getTextHighlightColorback to summary
public ColorUIResource getTextHighlightColor()

Returns the text highlight color. This returns the value of getPrimary3().

Returns:ColorUIResource

the text highlight color

getUserTextColorback to summary
public ColorUIResource getUserTextColor()

Returns the user text color. This returns the value of getBlack().

Returns:ColorUIResource

the user text color

getUserTextFontback to summary
public abstract FontUIResource getUserTextFont()

Returns the user text font.

Returns:FontUIResource

the user text font

getWhiteback to summary
protected ColorUIResource getWhite()

Returns the white color. This returns opaque white (0xFFFFFFFF).

Returns:ColorUIResource

the white color

getWindowBackgroundback to summary
public ColorUIResource getWindowBackground()

Returns the window background color. This returns the value of getWhite().

Returns:ColorUIResource

the window background color

getWindowTitleBackgroundback to summary
public ColorUIResource getWindowTitleBackground()

Returns the window title background color. This returns the value of getPrimary3().

Returns:ColorUIResource

the window title background color

getWindowTitleFontback to summary
public abstract FontUIResource getWindowTitleFont()

Returns the window title font.

Returns:FontUIResource

the window title font

getWindowTitleForegroundback to summary
public ColorUIResource getWindowTitleForeground()

Returns the window title foreground color. This returns the value of getBlack().

Returns:ColorUIResource

the window title foreground color

getWindowTitleInactiveBackgroundback to summary
public ColorUIResource getWindowTitleInactiveBackground()

Returns the window title inactive background color. This returns the value of getSecondary3().

Returns:ColorUIResource

the window title inactive background color

getWindowTitleInactiveForegroundback to summary
public ColorUIResource getWindowTitleInactiveForeground()

Returns the window title inactive foreground color. This returns the value of getBlack().

Returns:ColorUIResource

the window title inactive foreground color

installback to summary
pack-priv void install()

This is invoked when a MetalLookAndFeel is installed and about to start using this theme. When we can add API this should be nuked in favor of DefaultMetalTheme overriding addCustomEntriesToTable.

isSystemThemeback to summary
pack-priv boolean isSystemTheme()

Returns true if this is a theme provided by the core platform.