Serializable
NimbusLookAndFeel
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
. SynthIcon
interface provides paintIcon(synthContext, graphics, x, y, width, height)
method that allows to draw the icon with the given SynthContext
.
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 | Description |
---|---|
SynthLookAndFeel() |
Creates a SynthLookAndFeel. |
Modifier and Type | Method | Description |
---|---|---|
static ComponentUI |
createUI |
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 |
Returns the Region for the JComponent c . |
static SynthStyle |
getStyle |
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 |
Loads the set of SynthStyle s that will be used by this SynthLookAndFeel . |
void |
load |
Deprecated, for removal: This API element is subject to removal in a future version. |
static void |
setStyleFactory |
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 |
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 |
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
@Deprecated(since="21", forRemoval=true) public void load(URL url) throws ParseException, IOException
load(InputStream, Class)
or setStyleFactory(SynthStyleFactory)
insteadSynthStyle
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. Whilst this API may be safe for loading local resources that are delivered with a LookAndFeel
or application, and so have an equal level of trust with application code, using it to load from remote resources, particularly any which may have a lower level of trust, is strongly discouraged. The alternative mechanisms to load styles from an InputStream
load(InputStream, Class) using resources co-located with the application or by providing a SynthStyleFactory
to setStyleFactory(SynthStyleFactory) are preferred. Consequently this method is deprecated and will be removed in a future release.
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 LookAndFeel
public void uninitialize()
uninitialize
in class LookAndFeel
public UIDefaults getDefaults()
getDefaults
in class BasicLookAndFeel
public boolean isSupportedLookAndFeel()
isSupportedLookAndFeel
in class 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
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/plaf/synth/SynthLookAndFeel.html
load(InputStream, Class)
orsetStyleFactory(SynthStyleFactory)
instead