Spec-Zone .ru
спецификации, руководства, описания, API
|
|
Java™ Platform Standard Ed. 7 DRAFT ea-b118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.LookAndFeel javax.swing.plaf.basic.BasicLookAndFeel javax.swing.plaf.synth.SynthLookAndFeel javax.swing.plaf.nimbus.NimbusLookAndFeel
public class NimbusLookAndFeel extends SynthLookAndFeel
The NimbusLookAndFeel class.
Constructor and Description |
---|
NimbusLookAndFeel()
Create a new NimbusLookAndFeel. |
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 an Icon 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 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 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NimbusLookAndFeel()
Method Detail |
---|
public void initialize()
initialize
in class SynthLookAndFeel
LookAndFeel.uninitialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public void uninitialize()
uninitialize
in class SynthLookAndFeel
LookAndFeel.initialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public UIDefaults getDefaults()
SynthLookAndFeel
getDefaults
in class SynthLookAndFeel
BasicLookAndFeel.initClassDefaults(javax.swing.UIDefaults)
,
BasicLookAndFeel.initSystemColorDefaults(javax.swing.UIDefaults)
,
BasicLookAndFeel.initComponentDefaults(javax.swing.UIDefaults)
public static NimbusStyle getStyle(JComponent c, Region r)
c
- a non-null reference to a JComponentr
- a non-null reference to the region of the component cpublic String getName()
getName
in class SynthLookAndFeel
public String getID()
getID
in class SynthLookAndFeel
public String getDescription()
getDescription
in class SynthLookAndFeel
public boolean shouldUpdateStyleOnAncestorChanged()
SynthLookAndFeel
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.
shouldUpdateStyleOnAncestorChanged
in class SynthLookAndFeel
true
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
SynthLookAndFeel
shouldUpdateStyleOnEvent
in class SynthLookAndFeel
ev
- a PropertyChangeEvent
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));
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"public Icon getDisabledIcon(JComponent component, Icon icon)
LookAndFeel
Icon
with a disabled appearance.
This method is used to generate a disabled Icon
when
one has not been specified. For example, if you create a
JButton
and only specify an Icon
via
setIcon
this method will be called to generate the
disabled Icon
. If null
is passed as
icon
this method returns null
.
Some look and feels might not render the disabled Icon
, in which
case they will ignore this.
getDisabledIcon
in class LookAndFeel
component
- JComponent
that will display the Icon
,
may be null
icon
- Icon
to generate the disabled icon fromIcon
, or null
if a suitable
Icon
can not be generatedpublic Color getDerivedColor(String uiDefaultParentName, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource)
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 beprotected final Color getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource)
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 UIResourceprotected final Color getDerivedColor(Color color1, Color color2, float midPoint)
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;
|
Java™ Platform Standard Ed. 7 DRAFT ea-b118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1993, 2010, Oracle Corporation. All rights reserved.