Class NimbusLookAndFeel
- All Implemented Interfaces:
Serializable
The NimbusLookAndFeel class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final ColorgetDerivedColor(Color color1, Color color2, float midPoint) Decodes and returns a color, which is derived from a offset between two other colors.protected final ColorgetDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource) Decodes and returns a color, which is derived from an offset between two other colors.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.Returns a textual description of this look and feel.getID()Return a string that identifies this look and feel.getName()Return a short string that identifies this look and feel.static NimbusStylegetStyle(JComponent c, Region r) Gets the style associated with the given component and region.voidCalled by UIManager when this look and feel is installed.voidRegisters a third party component with the NimbusLookAndFeel.booleanReturns whether or not the UIs should update theirSynthStylesfrom theSynthStyleFactorywhen the ancestor of theJComponentchanges.protected booleanReturns whether or not the UIs should update their styles when a particular event occurs.voidCalled by UIManager when this look and feel is uninstalled.Methods declared in class SynthLookAndFeel
createUI, getDefaults, getRegion, getStyleFactory, isNativeLookAndFeel, isSupportedLookAndFeel, load, setStyleFactory, updateStylesModifier and TypeMethodDescriptionstatic ComponentUICreates the Synth look and feelComponentUIfor the passed inJComponent.Returns the defaults for this SynthLookAndFeel.static RegionReturns the Region for the JComponentc.static SynthStyleFactoryReturns the current SynthStyleFactory.booleanReturns false, SynthLookAndFeel is not a native look and feel.booleanReturns true, SynthLookAndFeel is always supported.voidload(InputStream input, Class<?> resourceBase) Loads the set ofSynthStyles that will be used by thisSynthLookAndFeel.static voidsetStyleFactory(SynthStyleFactory cache) Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.static voidUpdates the style associated withc, and all its children.Methods declared in class BasicLookAndFeel
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSoundModifier and TypeMethodDescriptionprotected ActioncreateAudioAction(Object key) Creates and returns anActionused to play a sound.protected ActionMapReturns anActionMapcontaining the audio actions for this look and feel.protected voidinitClassDefaults(UIDefaults table) Populatestablewith mappings fromuiClassIDto the fully qualified name of the ui class.protected voidinitComponentDefaults(UIDefaults table) Populatestablewith the defaults for the basic look and feel.protected voidPopulatestablewith system colors.protected voidloadSystemColors(UIDefaults table, String[] systemColors, boolean useNative) Populatestablewith thename-colorpairs insystemColors.protected voidIf necessary, invokesactionPerformedonaudioActionto play a sound.Methods declared in class LookAndFeel
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorderModifier and TypeMethodDescriptionstatic ObjectgetDesktopPropertyValue(String systemPropertyName, Object fallbackValue) Returns the value of the specified system desktop property by invokingToolkit.getDefaultToolkit().getDesktopProperty().getDisabledIcon(JComponent component, Icon icon) Returns anIconwith a disabled appearance.getDisabledSelectedIcon(JComponent component, Icon icon) Returns anIconfor use by disabled components that are also selected.Returns theLayoutStylefor this look and feel.booleanReturnstrueif theLookAndFeelreturnedRootPaneUIinstances support providingWindowdecorations in aJRootPane.static voidinstallBorder(JComponent c, String defaultBorderName) Convenience method for setting a component's border property with a value from the defaults.static voidinstallColors(JComponent c, String defaultBgName, String defaultFgName) Convenience method for setting a component's foreground and background color properties with values from the defaults.static voidinstallColorsAndFont(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 voidinstallProperty(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 voidloadKeyBindings(InputMap retMap, Object[] keys) Populates anInputMapwith the specified bindings.static ComponentInputMapmakeComponentInputMap(JComponent c, Object[] keys) Creates aComponentInputMapUIResourcefromkeys.static ObjectCreates and returns aUIDefault.LazyValuethat loads an image.static InputMapmakeInputMap(Object[] keys) Creates anInputMapUIResourcefromkeys.static JTextComponent.KeyBinding[]makeKeyBindings(Object[] keyBindingList) Convenience method for building an array ofKeyBindings.voidprovideErrorFeedback(Component component) Invoked when the user attempts an invalid operation, such as pasting into an uneditableJTextFieldthat has focus.toString()Returns a string that displays and identifies this object's properties.static voidConvenience method for uninstalling a border.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()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 thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(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 voidwait(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:
initializein classSynthLookAndFeel- See Also:
-
uninitialize
public void uninitialize()Called by UIManager when this look and feel is uninstalled.- Overrides:
uninitializein classSynthLookAndFeel- See Also:
-
getStyle
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 JComponentr- a non-null reference to the region of the component c- Returns:
- a non-null reference to a NimbusStyle.
-
getName
Return a short string that identifies this look and feel. This String will be the unquoted String "Nimbus".- Overrides:
getNamein classSynthLookAndFeel- Returns:
- a short string identifying this look and feel.
-
getID
Return a string that identifies this look and feel. This String will be the unquoted String "Nimbus".- Overrides:
getIDin classSynthLookAndFeel- Returns:
- a short string identifying this look and feel.
-
getDescription
Returns a textual description of this look and feel.- Overrides:
getDescriptionin classSynthLookAndFeel- Returns:
- textual description of this look and feel.
-
shouldUpdateStyleOnAncestorChanged
public boolean shouldUpdateStyleOnAncestorChanged()Returns whether or not the UIs should update theirSynthStylesfrom theSynthStyleFactorywhen the ancestor of theJComponentchanges. A subclass that provided aSynthStyleFactorythat based the return value fromgetStyleoff the containment hierarchy would override this method to return true.- Overrides:
shouldUpdateStyleOnAncestorChangedin classSynthLookAndFeel- Returns:
true
-
shouldUpdateStyleOnEvent
Returns whether or not the UIs should update their styles when a particular event occurs.Overridden to return
truewhen one of the following properties change:"Nimbus.Overrides""Nimbus.Overrides.InheritDefaults""JComponent.sizeVariant"
- Overrides:
shouldUpdateStyleOnEventin classSynthLookAndFeel- Parameters:
ev- aPropertyChangeEvent- Returns:
- whether or not the UIs should update their styles
- Since:
- 1.7
-
register
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
getStylemethod.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
prefixFor 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 keyhOffset- The hue offsetsOffset- The saturation offsetbOffset- The brightness offsetaOffset- The alpha offsetuiResource- 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 colorcolor2- The second colormidPoint- 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
Decodes and returns a color, which is derived from a offset between two other colors.- Parameters:
color1- The first colorcolor2- The second colormidPoint- 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
-