Class SynthLookAndFeel
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NimbusLookAndFeel
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.
- Since:
- 1.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentUICreates the Synth look and feelComponentUIfor the passed inJComponent.Returns the defaults for this SynthLookAndFeel.Returns a textual description of SynthLookAndFeel.getID()Return a string that identifies this look and feel.getName()Return a short string that identifies this look and feel.static RegionReturns the Region for the JComponentc.static SynthStylegetStyle(JComponent c, Region region) Gets a SynthStyle for the specified region of the specified component.static SynthStyleFactoryReturns the current SynthStyleFactory.voidCalled by UIManager when this look and feel is installed.booleanReturns false, SynthLookAndFeel is not a native look and feel.booleanReturns true, SynthLookAndFeel is always supported.voidload(InputStream input, Class<?> resourceBase) Loads the set ofSynthStyles that will be used by thisSynthLookAndFeel.voidDeprecated, for removal: This API element is subject to removal in a future version.static voidsetStyleFactory(SynthStyleFactory cache) Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.booleanReturns whether or not the UIs should update theirSynthStylesfrom theSynthStyleFactorywhen the ancestor of theJComponentchanges.protected booleanReturns whether or not the UIs should update their styles when a particular event occurs.voidCalled by UIManager when this look and feel is uninstalled.static voidUpdates the style associated withc, and all its children.Methods declared in class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSoundMethods declared in class javax.swing.LookAndFeel
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
-
Constructor Details
-
SynthLookAndFeel
public SynthLookAndFeel()Creates a SynthLookAndFeel.For the returned
SynthLookAndFeelto be useful you need to invokeloadto specify the set ofSynthStyles, or invokesetStyleFactory.- See Also:
-
-
Method Details
-
setStyleFactory
Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.- Parameters:
cache- SynthStyleFactory the UIs should use.
-
getStyleFactory
Returns the current SynthStyleFactory.- Returns:
- SynthStyleFactory
-
getStyle
Gets a SynthStyle for the specified region of the specified component. This is not for general consumption, only custom UIs should call this method.- Parameters:
c- JComponent to get the SynthStyle forregion- Identifies the region of the specified component- Returns:
- SynthStyle to use.
-
updateStyles
Updates the style associated withc, and all its children. This is a lighter version ofSwingUtilities.updateComponentTreeUI.- Parameters:
c- Component to update style for.
-
getRegion
Returns the Region for the JComponentc.- Parameters:
c- JComponent to fetch the Region for- Returns:
- Region corresponding to
c
-
createUI
Creates the Synth look and feelComponentUIfor the passed inJComponent.- Parameters:
c- JComponent to create theComponentUIfor- Returns:
- ComponentUI to use for
c
-
load
Loads the set ofSynthStyles that will be used by thisSynthLookAndFeel.resourceBaseis used to resolve any path based resources, for example anImagewould be resolved byresourceBase.getResource(path). Refer to Synth File Format for more information.- Parameters:
input- InputStream to load fromresourceBase- used to resolve any images or other resources- Throws:
ParseException- if there is an error in parsingIllegalArgumentException- if input or resourceBase isnull
-
load
@Deprecated(since="21", forRemoval=true) public void load(URL url) throws ParseException, IOException Deprecated, for removal: This API element is subject to removal in a future version.Useload(InputStream, Class)orsetStyleFactory(SynthStyleFactory)insteadLoads the set ofSynthStyles that will be used by thisSynthLookAndFeel. Path based resources are resolved relatively to the specifiedURLof the style. For example anImagewould be resolved bynew 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
LookAndFeelor 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 anInputStreamload(InputStream, Class) using resources co-located with the application or by providing aSynthStyleFactoryto setStyleFactory(SynthStyleFactory) are preferred. Consequently this method is deprecated and will be removed in a future release.- Parameters:
url- theURLto load the set ofSynthStylefrom- Throws:
ParseException- if there is an error in parsingIllegalArgumentException- if synthSet isnullIOException- if synthSet cannot be opened as anInputStream- Since:
- 1.6
-
initialize
public void initialize()Called by UIManager when this look and feel is installed.- Overrides:
initializein classLookAndFeel- See Also:
-
uninitialize
public void uninitialize()Called by UIManager when this look and feel is uninstalled.- Overrides:
uninitializein classLookAndFeel- See Also:
-
getDefaults
Returns the defaults for this SynthLookAndFeel.- Overrides:
getDefaultsin classBasicLookAndFeel- Returns:
- Defaults table.
- See Also:
-
isSupportedLookAndFeel
public boolean isSupportedLookAndFeel()Returns true, SynthLookAndFeel is always supported.- Specified by:
isSupportedLookAndFeelin classLookAndFeel- Returns:
- true.
- See Also:
-
isNativeLookAndFeel
public boolean isNativeLookAndFeel()Returns false, SynthLookAndFeel is not a native look and feel.- Specified by:
isNativeLookAndFeelin classLookAndFeel- Returns:
- false
-
getDescription
Returns a textual description of SynthLookAndFeel.- Specified by:
getDescriptionin classLookAndFeel- Returns:
- textual description of synth.
-
getName
Return a short string that identifies this look and feel.- Specified by:
getNamein classLookAndFeel- Returns:
- a short string identifying this look and feel.
-
getID
Return a string that identifies this look and feel.- Specified by:
getIDin classLookAndFeel- Returns:
- a short string identifying this look and feel.
-
shouldUpdateStyleOnAncestorChanged
public boolean shouldUpdateStyleOnAncestorChanged()Returns whether or not the UIs should update theirSynthStylesfrom theSynthStyleFactorywhen the ancestor of theJComponentchanges. A subclass that provided aSynthStyleFactorythat based the return value fromgetStyleoff the containment hierarchy would override this method to return true.- Returns:
- whether or not the UIs should update their
SynthStylesfrom theSynthStyleFactorywhen the ancestor changed.
-
shouldUpdateStyleOnEvent
Returns whether or not the UIs should update their styles when a particular event occurs.- Parameters:
ev- aPropertyChangeEvent- Returns:
- whether or not the UIs should update their styles
- Since:
- 1.7
-
load(InputStream, Class)orsetStyleFactory(SynthStyleFactory)instead