public class SynthLookAndFeel extends BasicLookAndFeel
load(java.io.InputStream, java.lang.Class<?>)
method, or provide your own SynthStyleFactory
to setStyleFactory(javax.swing.plaf.synth.SynthStyleFactory)
. Refer to the
package summary for an example of
loading a file, and SynthStyleFactory
for
an example of providing your own SynthStyleFactory
to
setStyleFactory
.
Warning:
This class implements Serializable
as a side effect of it
extending BasicLookAndFeel
. It is not intended to be serialized.
An attempt to serialize it will
result in NotSerializableException
.
Constructor and Description |
---|
SynthLookAndFeel()
Creates a SynthLookAndFeel.
|
Modifier and Type | Method and 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.
|
String |
getDescription()
Returns a textual description of SynthLookAndFeel.
|
String |
getID()
Return a string that identifies this look and feel.
|
String |
getName()
Return a short string that identifies this look and feel.
|
static Region |
getRegion(JComponent c)
Returns the Region for the JComponent
c . |
static SynthStyle |
getStyle(JComponent c,
Region region)
Gets a SynthStyle for the specified region of the specified component.
|
static SynthStyleFactory |
getStyleFactory()
Returns the current SynthStyleFactory.
|
void |
initialize()
Called by UIManager when this look and feel is installed.
|
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 . |
void |
load(URL url)
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.
|
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.
|
static void |
updateStyles(Component c)
Updates the style associated with
c , and all its children. |
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
public SynthLookAndFeel()
For the returned SynthLookAndFeel
to be useful you need to
invoke load
to specify the set of
SynthStyle
s, or invoke setStyleFactory
.
public static void setStyleFactory(SynthStyleFactory cache)
cache
- SynthStyleFactory the UIs should use.public static SynthStyleFactory getStyleFactory()
public static SynthStyle getStyle(JComponent c, Region region)
c
- JComponent to get the SynthStyle forregion
- Identifies the region of the specified componentpublic static void updateStyles(Component c)
c
, and all its children.
This is a lighter version of
SwingUtilities.updateComponentTreeUI
.c
- Component to update style for.public static Region getRegion(JComponent c)
c
.c
- JComponent to fetch the Region forc
public static ComponentUI createUI(JComponent c)
ComponentUI
for
the passed in JComponent
.c
- JComponent to create the ComponentUI
forc
public void load(InputStream input, Class<?> resourceBase) throws ParseException
SynthStyle
s that will be used by
this SynthLookAndFeel
. resourceBase
is
used to resolve any path based resources, for example an
Image
would be resolved by
resourceBase.getResource(path)
. Refer to
Synth File Format
for more information.input
- InputStream to load fromresourceBase
- used to resolve any images or other resourcesParseException
- if there is an error in parsingIllegalArgumentException
- if input or resourceBase is null
public void load(URL url) throws ParseException, IOException
SynthStyle
s that will be used by
this SynthLookAndFeel
. Path based resources are resolved
relatively to the specified URL
of the style. For example
an Image
would be resolved by
new URL(synthFile, path)
. Refer to
Synth File Format for more
information.url
- the URL
to load the set of
SynthStyle
fromParseException
- if there is an error in parsingIllegalArgumentException
- if synthSet is null
IOException
- if synthSet cannot be opened as an InputStream
public void initialize()
initialize
in class BasicLookAndFeel
LookAndFeel.uninitialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public void uninitialize()
uninitialize
in class BasicLookAndFeel
LookAndFeel.initialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public UIDefaults getDefaults()
getDefaults
in class BasicLookAndFeel
BasicLookAndFeel.initClassDefaults(javax.swing.UIDefaults)
,
BasicLookAndFeel.initSystemColorDefaults(javax.swing.UIDefaults)
,
BasicLookAndFeel.initComponentDefaults(javax.swing.UIDefaults)
public boolean isSupportedLookAndFeel()
isSupportedLookAndFeel
in class LookAndFeel
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public boolean isNativeLookAndFeel()
isNativeLookAndFeel
in class LookAndFeel
public String getDescription()
getDescription
in class LookAndFeel
public String getName()
getName
in class LookAndFeel
public String getID()
getID
in class LookAndFeel
public boolean shouldUpdateStyleOnAncestorChanged()
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.SynthStyles
from the SynthStyleFactory
when the ancestor changed.protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
ev
- a PropertyChangeEvent
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.