- 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 and Description NimbusLookAndFeel()
Create a new NimbusLookAndFeel.
-
Method Summary
Methods Modifier and Type Method and Description UIDefaults
getDefaults()
Returns the defaults for this SynthLookAndFeel.protected Color
getDerivedColor(Color color1, Color color2, float midPoint)
Decodes and returns a color, which is derived from a offset between two other colors.protected 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.Icon
getDisabledIcon(JComponent component, Icon icon)
Returns anIcon
with a disabled appearance.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 theirSynthStyles
from theSynthStyleFactory
when the ancestor of theJComponent
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 inherited from class javax.swing.plaf.synth.SynthLookAndFeel
createUI, getRegion, getStyleFactory, isNativeLookAndFeel, isSupportedLookAndFeel, load, load, setStyleFactory, updateStyles
-
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound
-
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
-
-
-
-
Method Detail
-
initialize
public void initialize()
Called by UIManager when this look and feel is installed.- Overrides:
initialize
in classSynthLookAndFeel
- See Also:
LookAndFeel.uninitialize()
,UIManager.setLookAndFeel(javax.swing.LookAndFeel)
-
uninitialize
public void uninitialize()
Called by UIManager when this look and feel is uninstalled.- Overrides:
uninitialize
in classSynthLookAndFeel
- See Also:
LookAndFeel.initialize()
,UIManager.setLookAndFeel(javax.swing.LookAndFeel)
-
getDefaults
public UIDefaults getDefaults()
Description copied from class:SynthLookAndFeel
Returns the defaults for this SynthLookAndFeel.- Overrides:
getDefaults
in classSynthLookAndFeel
- Returns:
- Defaults table.
- See Also:
BasicLookAndFeel.initClassDefaults(javax.swing.UIDefaults)
,BasicLookAndFeel.initSystemColorDefaults(javax.swing.UIDefaults)
,BasicLookAndFeel.initComponentDefaults(javax.swing.UIDefaults)
-
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 JComponentr
- 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 classSynthLookAndFeel
- 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 classSynthLookAndFeel
- 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 classSynthLookAndFeel
- Returns:
- textual description of this look and feel.
-
shouldUpdateStyleOnAncestorChanged
public boolean shouldUpdateStyleOnAncestorChanged()
Description copied from class:SynthLookAndFeel
Returns whether or not the UIs should update theirSynthStyles
from theSynthStyleFactory
when the ancestor of theJComponent
changes. A subclass that provided aSynthStyleFactory
that based the return value fromgetStyle
off the containment hierarchy would override this method to return true.- Overrides:
shouldUpdateStyleOnAncestorChanged
in classSynthLookAndFeel
- Returns:
true
-
shouldUpdateStyleOnEvent
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
Description copied from class:SynthLookAndFeel
Returns whether or not the UIs should update their styles when a particular event occurs.- Overrides:
shouldUpdateStyleOnEvent
in classSynthLookAndFeel
- Parameters:
ev
- aPropertyChangeEvent
- 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"
-
getDisabledIcon
public Icon getDisabledIcon(JComponent component, Icon icon)
Description copied from class:LookAndFeel
Returns anIcon
with a disabled appearance. This method is used to generate a disabledIcon
when one has not been specified. For example, if you create aJButton
and only specify anIcon
viasetIcon
this method will be called to generate the disabledIcon
. Ifnull
is passed asicon
this method returnsnull
.Some look and feels might not render the disabled
Icon
, in which case they will ignore this.- Overrides:
getDisabledIcon
in classLookAndFeel
- Parameters:
component
-JComponent
that will display theIcon
, may benull
icon
-Icon
to generate the disabled icon from- Returns:
- disabled
Icon
, ornull
if a suitableIcon
can not be generated
-
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
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 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
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/plaf/nimbus/nimbuslookandfeel.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.