# Class NimbusLookAndFeel

java.lang.Object
javax.swing.LookAndFeel
javax.swing.plaf.basic.BasicLookAndFeel
javax.swing.plaf.synth.SynthLookAndFeel
javax.swing.plaf.nimbus.NimbusLookAndFeel

All Implemented Interfaces:
  `Serializable`

public class NimbusLookAndFeel extends SynthLookAndFeel

The NimbusLookAndFeel class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NimbusLookAndFeel()`
  Create a new NimbusLookAndFeel.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected final Color`
  `getDerivedColor(Color color1, Color color2, float midPoint)`
  Decodes and returns a color, which is derived from a offset between two other colors.
  `protected final Color`
  `getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource)`
  Decodes and returns a color, which is derived from an offset between two other colors.
  `Color`
  `getDerivedColor(String uiDefaultParentName, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource)`
  Get a derived color, derived colors are shared instances and is color value will change when its parent UIDefault color changes.
  `String`
  `getDescription()`
  Returns a textual description of this look and feel.
  `String`
  `getID()`
  Return a string that identifies this look and feel.
  `String`
  `getName()`
  Return a short string that identifies this look and feel.
  `static NimbusStyle`
  `getStyle(JComponent c, Region r)`
  Gets the style associated with the given component and region.
  `void`
  `initialize()`
  Called by UIManager when this look and feel is installed.
  `void`
  `register(Region region, String prefix)`
  Registers a third party component with the NimbusLookAndFeel.
  `boolean`
  `shouldUpdateStyleOnAncestorChanged()`
  Returns whether or not the UIs should update their `SynthStyles` from the `SynthStyleFactory` when the ancestor of the `JComponent` changes.
  `protected boolean`
  `shouldUpdateStyleOnEvent(PropertyChangeEvent ev)`
  Returns whether or not the UIs should update their styles when a particular event occurs.
  `void`
  `uninitialize()`
  Called by UIManager when this look and feel is uninstalled.

  ### Methods declared in class SynthLookAndFeel

  `createUI, getDefaults, getRegion, getStyleFactory, isNativeLookAndFeel, isSupportedLookAndFeel, load, setStyleFactory, updateStyles`
  Modifier and Type
  Method
  Description
  `static ComponentUI`
  `createUI(JComponent c)`
  Creates the Synth look and feel `ComponentUI` for the passed in `JComponent`.
  `UIDefaults`
  `getDefaults()`
  Returns the defaults for this SynthLookAndFeel.
  `static Region`
  `getRegion(JComponent c)`
  Returns the Region for the JComponent `c`.
  `static SynthStyleFactory`
  `getStyleFactory()`
  Returns the current SynthStyleFactory.
  `boolean`
  `isNativeLookAndFeel()`
  Returns false, SynthLookAndFeel is not a native look and feel.
  `boolean`
  `isSupportedLookAndFeel()`
  Returns true, SynthLookAndFeel is always supported.
  `void`
  `load(InputStream input, Class<?> resourceBase)`
  Loads the set of `SynthStyle`s that will be used by this `SynthLookAndFeel`.
  `static void`
  `setStyleFactory(SynthStyleFactory cache)`
  Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.
  `static void`
  `updateStyles(Component c)`
  Updates the style associated with `c`, and all its children.

  ### Methods declared in class BasicLookAndFeel

  `createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound`
  Modifier and Type
  Method
  Description
  `protected Action`
  `createAudioAction(Object key)`
  Creates and returns an `Action` used to play a sound.
  `protected ActionMap`
  `getAudioActionMap()`
  Returns an `ActionMap` containing the audio actions for this look and feel.
  `protected void`
  `initClassDefaults(UIDefaults table)`
  Populates `table` with mappings from `uiClassID` to the fully qualified name of the ui class.
  `protected void`
  `initComponentDefaults(UIDefaults table)`
  Populates `table` with the defaults for the basic look and feel.
  `protected void`
  `initSystemColorDefaults(UIDefaults table)`
  Populates `table` with system colors.
  `protected void`
  `loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)`
  Populates `table` with the `name-color` pairs in `systemColors`.
  `protected void`
  `playSound(Action audioAction)`
  If necessary, invokes `actionPerformed` on `audioAction` to play a sound.

  ### Methods declared in class LookAndFeel

  `getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder`
  Modifier and Type
  Method
  Description
  `static Object`
  `getDesktopPropertyValue(String systemPropertyName, Object fallbackValue)`
  Returns the value of the specified system desktop property by invoking `Toolkit.getDefaultToolkit().getDesktopProperty()`.
  `Icon`
  `getDisabledIcon(JComponent component, Icon icon)`
  Returns an `Icon` with a disabled appearance.
  `Icon`
  `getDisabledSelectedIcon(JComponent component, Icon icon)`
  Returns an `Icon` for use by disabled components that are also selected.
  `LayoutStyle`
  `getLayoutStyle()`
  Returns the `LayoutStyle` for this look and feel.
  `boolean`
  `getSupportsWindowDecorations()`
  Returns `true` if the `LookAndFeel` returned `RootPaneUI` instances support providing `Window` decorations in a `JRootPane`.
  `static void`
  `installBorder(JComponent c, String defaultBorderName)`
  Convenience method for setting a component's border property with a value from the defaults.
  `static void`
  `installColors(JComponent c, String defaultBgName, String defaultFgName)`
  Convenience method for setting a component's foreground and background color properties with values from the defaults.
  `static void`
  `installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName)`
  Convenience method for setting a component's foreground, background and font properties with values from the defaults.
  `static void`
  `installProperty(JComponent c, String propertyName, Object propertyValue)`
  Convenience method for installing a property with the specified name and value on a component if that property has not already been set by the developer.
  `static void`
  `loadKeyBindings(InputMap retMap, Object[] keys)`
  Populates an `InputMap` with the specified bindings.
  `static ComponentInputMap`
  `makeComponentInputMap(JComponent c, Object[] keys)`
  Creates a `ComponentInputMapUIResource` from `keys`.
  `static Object`
  `makeIcon(Class<?> baseClass, String gifFile)`
  Creates and returns a `UIDefault.LazyValue` that loads an image.
  `static InputMap`
  `makeInputMap(Object[] keys)`
  Creates an `InputMapUIResource` from `keys`.
  `static JTextComponent.KeyBinding[]`
  `makeKeyBindings(Object[] keyBindingList)`
  Convenience method for building an array of `KeyBindings`.
  `void`
  `provideErrorFeedback(Component component)`
  Invoked when the user attempts an invalid operation, such as pasting into an uneditable `JTextField` that has focus.
  `String`
  `toString()`
  Returns a string that displays and identifies this object's properties.
  `static void`
  `uninstallBorder(JComponent c)`
  Convenience method for uninstalling a border.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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.
  `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

  - ### NimbusLookAndFeel

    public NimbusLookAndFeel()
    Create a new NimbusLookAndFeel.

- ## Method Details

  - ### initialize

    public void initialize()
    Called by UIManager when this look and feel is installed.
    Overrides:
      `initialize` in class `SynthLookAndFeel`
    See Also:
      - `LookAndFeel.uninitialize()`
      - `UIManager.setLookAndFeel(LookAndFeel)`

  - ### uninitialize

    public void uninitialize()
    Called by UIManager when this look and feel is uninstalled.
    Overrides:
      `uninitialize` in class `SynthLookAndFeel`
    See Also:
      - `LookAndFeel.initialize()`
      - `UIManager.setLookAndFeel(LookAndFeel)`

  - ### getStyle

    public static NimbusStyle getStyle(JComponent c, Region r)
    Gets the style associated with the given component and region. This will never return null. If an appropriate component and region cannot be determined, then a default style is returned.
    Parameters:
      `c` - a non-null reference to a JComponent
      `r` - a non-null reference to the region of the component c
    Returns:
      a non-null reference to a NimbusStyle.

  - ### getName

    public String getName()
    Return a short string that identifies this look and feel. This String will be the unquoted String "Nimbus".
    Overrides:
      `getName` in class `SynthLookAndFeel`
    Returns:
      a short string identifying this look and feel.

  - ### getID

    public String getID()
    Return a string that identifies this look and feel. This String will be the unquoted String "Nimbus".
    Overrides:
      `getID` in class `SynthLookAndFeel`
    Returns:
      a short string identifying this look and feel.

  - ### getDescription

    public String getDescription()
    Returns a textual description of this look and feel.
    Overrides:
      `getDescription` in class `SynthLookAndFeel`
    Returns:
      textual description of this look and feel.

  - ### shouldUpdateStyleOnAncestorChanged

    public boolean shouldUpdateStyleOnAncestorChanged()
    Returns whether or not the UIs should update their `SynthStyles` from the `SynthStyleFactory` when the ancestor of the `JComponent` changes. A subclass that provided a `SynthStyleFactory` that based the return value from `getStyle` off the containment hierarchy would override this method to return true.
    Overrides:
      `shouldUpdateStyleOnAncestorChanged` in class `SynthLookAndFeel`
    Returns:
      `true`

  - ### shouldUpdateStyleOnEvent

    protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
    Returns whether or not the UIs should update their styles when a particular event occurs.

    Overridden to return `true` when one of the following properties change:

    - `"Nimbus.Overrides"`
    - `"Nimbus.Overrides.InheritDefaults"`
    - `"JComponent.sizeVariant"`
    Overrides:
      `shouldUpdateStyleOnEvent` in class `SynthLookAndFeel`
    Parameters:
      `ev` - a `PropertyChangeEvent`
    Returns:
      whether or not the UIs should update their styles
    Since:
      1.7

  - ### register

    public void register(Region region, String prefix)

    Registers a third party component with the NimbusLookAndFeel.

    Regions represent Components and areas within Components that act as independent painting areas. Once registered with the NimbusLookAndFeel, NimbusStyles for these Regions can be retrieved via the `getStyle` method.

    The NimbusLookAndFeel uses a standard naming scheme for entries in the UIDefaults table. The key for each property, state, painter, and other default registered in UIDefaults for a specific Region will begin with the specified `prefix`

    For example, suppose I had a component named JFoo. Suppose I then registered this component with the NimbusLookAndFeel in this manner:

            laf.register(NimbusFooUI.FOO_REGION, "Foo");

    In this case, I could then register properties for this component with UIDefaults in the following manner:

            UIManager.put("Foo.background", new ColorUIResource(Color.BLACK));
            UIManager.put("Foo.Enabled.backgroundPainter", new FooBackgroundPainter());

    It is also possible to register a named component with Nimbus. For example, suppose you wanted to style the background of a JPanel named "MyPanel" differently from other JPanels. You could accomplish this by doing the following:

            laf.register(Region.PANEL, "\"MyPanel\"");
            UIManager.put("\"MyPanel\".background", new ColorUIResource(Color.RED));

    Parameters:
      `region` - The Synth Region that is being registered. Such as Button, or ScrollBarThumb, or NimbusFooUI.FOO_REGION.
      `prefix` - The UIDefault prefix. For example, could be ComboBox, or if a named components, "MyComboBox", or even something like ToolBar."MyComboBox"."ComboBox.arrowButton"

  - ### getDerivedColor

    public Color getDerivedColor(String uiDefaultParentName, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource)
    Get a derived color, derived colors are shared instances and is color value will change when its parent UIDefault color changes.
    Parameters:
      `uiDefaultParentName` - The parent UIDefault key
      `hOffset` - The hue offset
      `sOffset` - The saturation offset
      `bOffset` - The brightness offset
      `aOffset` - The alpha offset
      `uiResource` - True if the derived color should be a UIResource, false if it should not be
    Returns:
      The stored derived color

  - ### getDerivedColor

    protected final Color getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource)
    Decodes and returns a color, which is derived from an offset between two other colors.
    Parameters:
      `color1` - The first color
      `color2` - The second color
      `midPoint` - The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2;
      `uiResource` - True if the derived color should be a UIResource
    Returns:
      The derived color

  - ### getDerivedColor

    protected final Color getDerivedColor(Color color1, Color color2, float midPoint)
    Decodes and returns a color, which is derived from a offset between two other colors.
    Parameters:
      `color1` - The first color
      `color2` - The second color
      `midPoint` - The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2;
    Returns:
      The derived color, which will be a UIResource