| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
SynthLookAndFeel laf = new SynthLookAndFeel();
Based on 171 examples
public class SynthLookAndFeel extends BasicLookAndFeel
SynthLookAndFeel provides the basis for creating a customized look and
feel. SynthLookAndFeel does not directly provide a look, all painting is
delegated.
You need to either provide a configuration file, by way of the
{@link #load} method, or provide your own {@link SynthStyleFactory}
to {@link #setStyleFactory}. Refer to the
package summary for an example of
loading a file, and {@link javax.swing.plaf.synth.SynthStyleFactory} for
an example of providing your own SynthStyleFactory
to
setStyleFactory
.
Warning: This class implements {@link Serializable} as a side effect of it extending {@link BasicLookAndFeel}. It is not intended to be serialized. An attempt to serialize it will result in {@link NotSerializableException}.
Constructor Summary | |
---|---|
Creates a SynthLookAndFeel. |
Method Summary | |
---|---|
static ComponentUI |
Creates the Synth look and feel ComponentUI for
the passed in JComponent .
|
UIDefaults |
Returns the defaults for this SynthLookAndFeel. |
String |
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 |
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 |
Returns the current SynthStyleFactory. |
void |
Called by UIManager when this look and feel is installed. |
boolean |
Returns false, SynthLookAndFeel is not a native look and feel. |
boolean |
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 |
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 |
Returns whether or not the UIs should update their SynthStyles from the SynthStyleFactory
when the ancestor of the JComponent changes.
|
void |
Called by UIManager when this look and feel is uninstalled. |
static void |
Updates the style associated with c , and all its children.
|
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel |
---|
createAudioAction, getAudioActionMap, getDefaults, initClassDefaults, initComponentDefaults, initialize, initSystemColorDefaults, loadSystemColors, playSound, uninitialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SynthLookAndFeel()
For the returned SynthLookAndFeel
to be useful you need to
invoke load
to specify the set of
SynthStyle
s, or invoke setStyleFactory
.
Method Detail |
---|
public static ComponentUI createUI(JComponent c)
ComponentUI
for
the passed in JComponent
.
c
- JComponent to create the ComponentUI
forc
public UIDefaults getDefaults()
getDefaults
in class BasicLookAndFeel
public String getDescription()
getDescription
in class LookAndFeel
public String getID()
getID
in class LookAndFeel
public String getName()
getName
in class LookAndFeel
public static Region getRegion(JComponent c)
c
.
c
- JComponent to fetch the Region forc
public static SynthStyle getStyle(JComponent c, Region region)
c
- JComponent to get the SynthStyle forregion
- Identifies the region of the specified componentpublic static SynthStyleFactory getStyleFactory()
public void initialize()
initialize
in class BasicLookAndFeel
public boolean isNativeLookAndFeel()
isNativeLookAndFeel
in class LookAndFeel
public boolean isSupportedLookAndFeel()
isSupportedLookAndFeel
in class LookAndFeel
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 parsingpublic 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 parsingIOException
- if synthSet cannot be opened as an InputStream
public static void setStyleFactory(SynthStyleFactory cache)
cache
- SynthStyleFactory the UIs should use.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.public void uninitialize()
uninitialize
in class BasicLookAndFeel
public static void updateStyles(Component c)
c
, and all its children.
This is a lighter version of
SwingUtilities.updateComponentTreeUI
.
c
- Component to update style for.
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |