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

# Class MetalIconFactory

java.lang.Object
javax.swing.plaf.metal.MetalIconFactory

All Implemented Interfaces:
  `Serializable`

public class MetalIconFactory extends Object implements Serializable
Factory object that vends `Icon`s for the Java look and feel (Metal). These icons are used extensively in Metal via the defaults mechanism. While other look and feels often use GIFs for icons, creating icons in code facilitates switching to other themes.

Each method in this class returns either an `Icon` or `null`, where `null` implies that there is no default icon.

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

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `MetalIconFactory.FileIcon16`
  Warning: Serialized objects of this class will not be compatible with future Swing releases.
  `static class`
  `MetalIconFactory.FolderIcon16`
  Warning: Serialized objects of this class will not be compatible with future Swing releases.
  `static class`
  `MetalIconFactory.PaletteCloseIcon`
  Defines an icon for Palette close
  `static class`
  `MetalIconFactory.TreeControlIcon`
  Warning: Serialized objects of this class will not be compatible with future Swing releases.
  `static class`
  `MetalIconFactory.TreeFolderIcon`
  Warning: Serialized objects of this class will not be compatible with future Swing releases.
  `static class`
  `MetalIconFactory.TreeLeafIcon`
  The class represents a tree leaf icon.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final boolean`
  `DARK`
  `DARK` is used for the property `Tree.expandedIcon`.
  `static final boolean`
  `LIGHT`
  `LIGHT` is used for the property `Tree.collapsedIcon`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MetalIconFactory()`
  Constructs a `MetalIconFactory`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Icon`
  `getCheckBoxIcon()`
  Returns a checkbox icon.
  `static Icon`
  `getCheckBoxMenuItemIcon()`
  Returns an icon to be used by `JCheckBoxMenuItem`.
  `static Icon`
  `getFileChooserDetailViewIcon()`
  Returns the instance of `FileChooserDetailViewIcon`.
  `static Icon`
  `getFileChooserHomeFolderIcon()`
  Returns the instance of `FileChooserHomeFolderIcon`.
  `static Icon`
  `getFileChooserListViewIcon()`
  Returns the instance of `FileChooserListViewIcon`.
  `static Icon`
  `getFileChooserNewFolderIcon()`
  Returns the instance of `FileChooserNewFolderIcon`.
  `static Icon`
  `getFileChooserUpFolderIcon()`
  Returns the instance of `FileChooserUpFolderIcon`.
  `static Icon`
  `getHorizontalSliderThumbIcon()`
  Returns a thumb icon to be used by horizontal slider.
  `static Icon`
  `getInternalFrameAltMaximizeIcon(int size)`
  Constructs a new instance of `InternalFrameAltMaximizeIcon`.
  `static Icon`
  `getInternalFrameCloseIcon(int size)`
  Constructs a new instance of `InternalFrameCloseIcon`.
  `static Icon`
  `getInternalFrameDefaultMenuIcon()`
  Returns the instance of `InternalFrameDefaultMenuIcon`.
  `static Icon`
  `getInternalFrameMaximizeIcon(int size)`
  Constructs a new instance of `InternalFrameMaximizeIcon`.
  `static Icon`
  `getInternalFrameMinimizeIcon(int size)`
  Constructs a new instance of `InternalFrameMinimizeIcon`.
  `static Icon`
  `getMenuArrowIcon()`
  Returns an icon to be used by `JMenu`.
  `static Icon`
  `getMenuItemArrowIcon()`
  Returns an icon to be used by `JMenuItem`.
  `static Icon`
  `getMenuItemCheckIcon()`
  Returns an icon to be used by `JCheckBoxMenuItem`.
  `static Icon`
  `getRadioButtonIcon()`
  Returns the instance of `RadioButtonIcon`.
  `static Icon`
  `getRadioButtonMenuItemIcon()`
  Returns an icon to be used by `JRadioButtonMenuItem`.
  `static Icon`
  `getTreeComputerIcon()`
  Returns the instance of `TreeComputerIcon`.
  `static Icon`
  `getTreeControlIcon(boolean isCollapsed)`
  Constructs a new instance of `TreeControlIcon`.
  `static Icon`
  `getTreeFloppyDriveIcon()`
  Returns the instance of `TreeFloppyDriveIcon`.
  `static Icon`
  `getTreeFolderIcon()`
  Constructs a new instance of `TreeFolderIcon`.
  `static Icon`
  `getTreeHardDriveIcon()`
  Returns the instance of `TreeHardDriveIcon`.
  `static Icon`
  `getTreeLeafIcon()`
  Constructs a new instance of `TreeLeafIcon`.
  `static Icon`
  `getVerticalSliderThumbIcon()`
  Returns a thumb icon to be used by vertical slider.

  ### 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.

- ## Field Details

  - ### DARK

    public static final boolean DARK
    `DARK` is used for the property `Tree.expandedIcon`.
    See Also:
      - Constant Field Values

  - ### LIGHT

    public static final boolean LIGHT
    `LIGHT` is used for the property `Tree.collapsedIcon`.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### MetalIconFactory

    public MetalIconFactory()
    Constructs a `MetalIconFactory`.

- ## Method Details

  - ### getFileChooserDetailViewIcon

    public static Icon getFileChooserDetailViewIcon()
    Returns the instance of `FileChooserDetailViewIcon`.
    Returns:
      the instance of `FileChooserDetailViewIcon`

  - ### getFileChooserHomeFolderIcon

    public static Icon getFileChooserHomeFolderIcon()
    Returns the instance of `FileChooserHomeFolderIcon`.
    Returns:
      the instance of `FileChooserHomeFolderIcon`

  - ### getFileChooserListViewIcon

    public static Icon getFileChooserListViewIcon()
    Returns the instance of `FileChooserListViewIcon`.
    Returns:
      the instance of `FileChooserListViewIcon`

  - ### getFileChooserNewFolderIcon

    public static Icon getFileChooserNewFolderIcon()
    Returns the instance of `FileChooserNewFolderIcon`.
    Returns:
      the instance of `FileChooserNewFolderIcon`

  - ### getFileChooserUpFolderIcon

    public static Icon getFileChooserUpFolderIcon()
    Returns the instance of `FileChooserUpFolderIcon`.
    Returns:
      the instance of `FileChooserUpFolderIcon`

  - ### getInternalFrameAltMaximizeIcon

    public static Icon getInternalFrameAltMaximizeIcon(int size)
    Constructs a new instance of `InternalFrameAltMaximizeIcon`.
    Parameters:
      `size` - the size of the icon
    Returns:
      a new instance of `InternalFrameAltMaximizeIcon`

  - ### getInternalFrameCloseIcon

    public static Icon getInternalFrameCloseIcon(int size)
    Constructs a new instance of `InternalFrameCloseIcon`.
    Parameters:
      `size` - the size of the icon
    Returns:
      a new instance of `InternalFrameCloseIcon`

  - ### getInternalFrameDefaultMenuIcon

    public static Icon getInternalFrameDefaultMenuIcon()
    Returns the instance of `InternalFrameDefaultMenuIcon`.
    Returns:
      the instance of `InternalFrameDefaultMenuIcon`

  - ### getInternalFrameMaximizeIcon

    public static Icon getInternalFrameMaximizeIcon(int size)
    Constructs a new instance of `InternalFrameMaximizeIcon`.
    Parameters:
      `size` - the size of the icon
    Returns:
      a new instance of `InternalFrameMaximizeIcon`

  - ### getInternalFrameMinimizeIcon

    public static Icon getInternalFrameMinimizeIcon(int size)
    Constructs a new instance of `InternalFrameMinimizeIcon`.
    Parameters:
      `size` - the size of the icon
    Returns:
      a new instance of `InternalFrameMinimizeIcon`

  - ### getRadioButtonIcon

    public static Icon getRadioButtonIcon()
    Returns the instance of `RadioButtonIcon`.
    Returns:
      the instance of `RadioButtonIcon`

  - ### getCheckBoxIcon

    public static Icon getCheckBoxIcon()
    Returns a checkbox icon.
    Returns:
      a checkbox icon
    Since:
      1.3

  - ### getTreeComputerIcon

    public static Icon getTreeComputerIcon()
    Returns the instance of `TreeComputerIcon`.
    Returns:
      the instance of `TreeComputerIcon`

  - ### getTreeFloppyDriveIcon

    public static Icon getTreeFloppyDriveIcon()
    Returns the instance of `TreeFloppyDriveIcon`.
    Returns:
      the instance of `TreeFloppyDriveIcon`

  - ### getTreeFolderIcon

    public static Icon getTreeFolderIcon()
    Constructs a new instance of `TreeFolderIcon`.
    Returns:
      a new instance of `TreeFolderIcon`

  - ### getTreeHardDriveIcon

    public static Icon getTreeHardDriveIcon()
    Returns the instance of `TreeHardDriveIcon`.
    Returns:
      the instance of `TreeHardDriveIcon`

  - ### getTreeLeafIcon

    public static Icon getTreeLeafIcon()
    Constructs a new instance of `TreeLeafIcon`.
    Returns:
      a new instance of `TreeLeafIcon`

  - ### getTreeControlIcon

    public static Icon getTreeControlIcon(boolean isCollapsed)
    Constructs a new instance of `TreeControlIcon`.
    Parameters:
      `isCollapsed` - if `true` the icon is collapsed
    Returns:
      a new instance of `TreeControlIcon`

  - ### getMenuArrowIcon

    public static Icon getMenuArrowIcon()
    Returns an icon to be used by `JMenu`.
    Returns:
      an icon to be used by `JMenu`

  - ### getMenuItemCheckIcon

    public static Icon getMenuItemCheckIcon()
    Returns an icon to be used by `JCheckBoxMenuItem`.
    Returns:
      the default icon for check box menu items, or `null` if no default exists

  - ### getMenuItemArrowIcon

    public static Icon getMenuItemArrowIcon()
    Returns an icon to be used by `JMenuItem`.
    Returns:
      an icon to be used by `JMenuItem`

  - ### getCheckBoxMenuItemIcon

    public static Icon getCheckBoxMenuItemIcon()
    Returns an icon to be used by `JCheckBoxMenuItem`.
    Returns:
      an icon to be used by `JCheckBoxMenuItem`

  - ### getRadioButtonMenuItemIcon

    public static Icon getRadioButtonMenuItemIcon()
    Returns an icon to be used by `JRadioButtonMenuItem`.
    Returns:
      an icon to be used by `JRadioButtonMenuItem`

  - ### getHorizontalSliderThumbIcon

    public static Icon getHorizontalSliderThumbIcon()
    Returns a thumb icon to be used by horizontal slider.
    Returns:
      a thumb icon to be used by horizontal slider

  - ### getVerticalSliderThumbIcon

    public static Icon getVerticalSliderThumbIcon()
    Returns a thumb icon to be used by vertical slider.
    Returns:
      a thumb icon to be used by vertical slider