DefaultMetalTheme (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.swing.plaf.metal, class: DefaultMetalTheme
Keywords: javax.swing.plaf.metal.DefaultMetalTheme class

# Class DefaultMetalTheme

java.lang.Object
javax.swing.plaf.metal.MetalTheme
javax.swing.plaf.metal.DefaultMetalTheme

Direct Known Subclasses:
  `OceanTheme`

public class DefaultMetalTheme extends MetalTheme
A concrete implementation of `MetalTheme` providing the original look of the Java Look and Feel, code-named "Steel". Refer to `MetalLookAndFeel.setCurrentTheme(MetalTheme)` for details on changing the default theme.

All colors returned by `DefaultMetalTheme` are completely opaque.

## Font Style

`DefaultMetalTheme` uses bold fonts for many controls. To make all controls (with the exception of the internal frame title bars and client decorated frame title bars) use plain fonts you can do either of the following:

- Set the system property `swing.boldMetal` to `false`. For example, `java -Dswing.boldMetal=false MyApp`.
- Set the defaults property `swing.boldMetal` to `Boolean.FALSE`. For example: `UIManager.put("swing.boldMetal", Boolean.FALSE);`

The defaults property `swing.boldMetal`, if set, takes precedence over the system property of the same name. After setting this defaults property you need to re-install `MetalLookAndFeel`, as well as update the UI of any previously created widgets. Otherwise the results are undefined. The following illustrates how to do this:

      // turn off bold fonts
      UIManager.put("swing.boldMetal", Boolean.FALSE);

      // 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);

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 `XMLEncoder`.

See Also:
  - `MetalLookAndFeel`
  - `MetalLookAndFeel.setCurrentTheme(MetalTheme)`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultMetalTheme()`
  Creates and returns an instance of `DefaultMetalTheme`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FontUIResource`
  `getControlTextFont()`
  Returns the control text font.
  `FontUIResource`
  `getMenuTextFont()`
  Returns the menu text font.
  `String`
  `getName()`
  Returns the name of this theme.
  `protected ColorUIResource`
  `getPrimary1()`
  Returns the primary 1 color.
  `protected ColorUIResource`
  `getPrimary2()`
  Returns the primary 2 color.
  `protected ColorUIResource`
  `getPrimary3()`
  Returns the primary 3 color.
  `protected ColorUIResource`
  `getSecondary1()`
  Returns the secondary 1 color.
  `protected ColorUIResource`
  `getSecondary2()`
  Returns the secondary 2 color.
  `protected ColorUIResource`
  `getSecondary3()`
  Returns the secondary 3 color.
  `FontUIResource`
  `getSubTextFont()`
  Returns the sub-text font.
  `FontUIResource`
  `getSystemTextFont()`
  Returns the system text font.
  `FontUIResource`
  `getUserTextFont()`
  Returns the user text font.
  `FontUIResource`
  `getWindowTitleFont()`
  Returns the window title font.

  ### Methods declared in class MetalTheme

  `addCustomEntriesToTable, getAcceleratorForeground, getAcceleratorSelectedForeground, getBlack, getControl, getControlDarkShadow, getControlDisabled, getControlHighlight, getControlInfo, getControlShadow, getControlTextColor, getDesktopColor, getFocusColor, getHighlightedTextColor, getInactiveControlTextColor, getInactiveSystemTextColor, getMenuBackground, getMenuDisabledForeground, getMenuForeground, getMenuSelectedBackground, getMenuSelectedForeground, getPrimaryControl, getPrimaryControlDarkShadow, getPrimaryControlHighlight, getPrimaryControlInfo, getPrimaryControlShadow, getSeparatorBackground, getSeparatorForeground, getSystemTextColor, getTextHighlightColor, getUserTextColor, getWhite, getWindowBackground, getWindowTitleBackground, getWindowTitleForeground, getWindowTitleInactiveBackground, getWindowTitleInactiveForeground`
  Modifier and Type
  Method
  Description
  `void`
  `addCustomEntriesToTable(UIDefaults table)`
  Adds values specific to this theme to the defaults table.
  `ColorUIResource`
  `getAcceleratorForeground()`
  Returns the accelerator foreground color.
  `ColorUIResource`
  `getAcceleratorSelectedForeground()`
  Returns the accelerator selected foreground color.
  `protected ColorUIResource`
  `getBlack()`
  Returns the black color.
  `ColorUIResource`
  `getControl()`
  Returns the control color.
  `ColorUIResource`
  `getControlDarkShadow()`
  Returns the control dark shadow color.
  `ColorUIResource`
  `getControlDisabled()`
  Returns the control disabled color.
  `ColorUIResource`
  `getControlHighlight()`
  Returns the control highlight color.
  `ColorUIResource`
  `getControlInfo()`
  Returns the control info color.
  `ColorUIResource`
  `getControlShadow()`
  Returns the control shadow color.
  `ColorUIResource`
  `getControlTextColor()`
  Returns the control text color.
  `ColorUIResource`
  `getDesktopColor()`
  Returns the desktop color.
  `ColorUIResource`
  `getFocusColor()`
  Returns the focus color.
  `ColorUIResource`
  `getHighlightedTextColor()`
  Returns the highlighted text color.
  `ColorUIResource`
  `getInactiveControlTextColor()`
  Returns the inactive control text color.
  `ColorUIResource`
  `getInactiveSystemTextColor()`
  Returns the inactive system text color.
  `ColorUIResource`
  `getMenuBackground()`
  Returns the menu background color.
  `ColorUIResource`
  `getMenuDisabledForeground()`
  Returns the menu disabled foreground color.
  `ColorUIResource`
  `getMenuForeground()`
  Returns the menu foreground color.
  `ColorUIResource`
  `getMenuSelectedBackground()`
  Returns the menu selected background color.
  `ColorUIResource`
  `getMenuSelectedForeground()`
  Returns the menu selected foreground color.
  `ColorUIResource`
  `getPrimaryControl()`
  Returns the primary control color.
  `ColorUIResource`
  `getPrimaryControlDarkShadow()`
  Returns the primary control dark shadow color.
  `ColorUIResource`
  `getPrimaryControlHighlight()`
  Returns the primary control highlight color.
  `ColorUIResource`
  `getPrimaryControlInfo()`
  Returns the primary control info color.
  `ColorUIResource`
  `getPrimaryControlShadow()`
  Returns the primary control shadow color.
  `ColorUIResource`
  `getSeparatorBackground()`
  Returns the separator background color.
  `ColorUIResource`
  `getSeparatorForeground()`
  Returns the separator foreground color.
  `ColorUIResource`
  `getSystemTextColor()`
  Returns the system text color.
  `ColorUIResource`
  `getTextHighlightColor()`
  Returns the text highlight color.
  `ColorUIResource`
  `getUserTextColor()`
  Returns the user text color.
  `protected ColorUIResource`
  `getWhite()`
  Returns the white color.
  `ColorUIResource`
  `getWindowBackground()`
  Returns the window background color.
  `ColorUIResource`
  `getWindowTitleBackground()`
  Returns the window title background color.
  `ColorUIResource`
  `getWindowTitleForeground()`
  Returns the window title foreground color.
  `ColorUIResource`
  `getWindowTitleInactiveBackground()`
  Returns the window title inactive background color.
  `ColorUIResource`
  `getWindowTitleInactiveForeground()`
  Returns the window title inactive foreground color.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### DefaultMetalTheme

    public DefaultMetalTheme()
    Creates and returns an instance of `DefaultMetalTheme`.

- ## Method Details

  - ### getName

    public String getName()
    Returns the name of this theme. This returns `"Steel"`.
    Specified by:
      `getName` in class `MetalTheme`
    Returns:
      the name of this theme.

  - ### getPrimary1

    protected ColorUIResource getPrimary1()
    Returns the primary 1 color. This returns a color with rgb values of 102, 102, and 153, respectively.
    Specified by:
      `getPrimary1` in class `MetalTheme`
    Returns:
      the primary 1 color

  - ### getPrimary2

    protected ColorUIResource getPrimary2()
    Returns the primary 2 color. This returns a color with rgb values of 153, 153, 204, respectively.
    Specified by:
      `getPrimary2` in class `MetalTheme`
    Returns:
      the primary 2 color

  - ### getPrimary3

    protected ColorUIResource getPrimary3()
    Returns the primary 3 color. This returns a color with rgb values 204, 204, 255, respectively.
    Specified by:
      `getPrimary3` in class `MetalTheme`
    Returns:
      the primary 3 color

  - ### getSecondary1

    protected ColorUIResource getSecondary1()
    Returns the secondary 1 color. This returns a color with rgb values 102, 102, and 102, respectively.
    Specified by:
      `getSecondary1` in class `MetalTheme`
    Returns:
      the secondary 1 color

  - ### getSecondary2

    protected ColorUIResource getSecondary2()
    Returns the secondary 2 color. This returns a color with rgb values 153, 153, and 153, respectively.
    Specified by:
      `getSecondary2` in class `MetalTheme`
    Returns:
      the secondary 2 color

  - ### getSecondary3

    protected ColorUIResource getSecondary3()
    Returns the secondary 3 color. This returns a color with rgb values 204, 204, and 204, respectively.
    Specified by:
      `getSecondary3` in class `MetalTheme`
    Returns:
      the secondary 3 color

  - ### getControlTextFont

    public FontUIResource getControlTextFont()
    Returns the control text font. This returns Dialog, 12pt. If plain fonts have been enabled as described in font style, the font style is plain. Otherwise the font style is bold.
    Specified by:
      `getControlTextFont` in class `MetalTheme`
    Returns:
      the control text font

  - ### getSystemTextFont

    public FontUIResource getSystemTextFont()
    Returns the system text font. This returns Dialog, 12pt, plain.
    Specified by:
      `getSystemTextFont` in class `MetalTheme`
    Returns:
      the system text font

  - ### getUserTextFont

    public FontUIResource getUserTextFont()
    Returns the user text font. This returns Dialog, 12pt, plain.
    Specified by:
      `getUserTextFont` in class `MetalTheme`
    Returns:
      the user text font

  - ### getMenuTextFont

    public FontUIResource getMenuTextFont()
    Returns the menu text font. This returns Dialog, 12pt. If plain fonts have been enabled as described in font style, the font style is plain. Otherwise the font style is bold.
    Specified by:
      `getMenuTextFont` in class `MetalTheme`
    Returns:
      the menu text font

  - ### getWindowTitleFont

    public FontUIResource getWindowTitleFont()
    Returns the window title font. This returns Dialog, 12pt, bold.
    Specified by:
      `getWindowTitleFont` in class `MetalTheme`
    Returns:
      the window title font

  - ### getSubTextFont

    public FontUIResource getSubTextFont()
    Returns the sub-text font. This returns Dialog, 10pt, plain.
    Specified by:
      `getSubTextFont` in class `MetalTheme`
    Returns:
      the sub-text font