- java.lang.Object
- 
- javax.swing.LookAndFeel
- 
- javax.swing.plaf.basic.BasicLookAndFeel
- 
- javax.swing.plaf.synth.SynthLookAndFeel
 
 
 
- 
- All Implemented Interfaces:
- Serializable
 - Direct Known Subclasses:
- NimbusLookAndFeel
 
 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 theload(java.io.InputStream, java.lang.Class<?>)method, or provide your ownSynthStyleFactorytosetStyleFactory(javax.swing.plaf.synth.SynthStyleFactory). Refer to the package summary for an example of loading a file, andSynthStyleFactoryfor an example of providing your ownSynthStyleFactorytosetStyleFactory.SynthIconinterface providespaintIcon(synthContext, graphics, x, y, width, height)method that allows to draw the icon with the givenSynthContext.Warning: This class implements Serializableas a side effect of it extendingBasicLookAndFeel. It is not intended to be serialized. An attempt to serialize it will result inNotSerializableException.- Since:
- 1.5
 
- 
- 
Constructor SummaryConstructors Constructor Description SynthLookAndFeel()Creates a SynthLookAndFeel.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ComponentUIcreateUI(JComponent c)Creates the Synth look and feelComponentUIfor the passed inJComponent.UIDefaultsgetDefaults()Returns the defaults for this SynthLookAndFeel.StringgetDescription()Returns a textual description of SynthLookAndFeel.StringgetID()Return a string that identifies this look and feel.StringgetName()Return a short string that identifies this look and feel.static RegiongetRegion(JComponent c)Returns the Region for the JComponentc.static SynthStylegetStyle(JComponent c, Region region)Gets a SynthStyle for the specified region of the specified component.static SynthStyleFactorygetStyleFactory()Returns the current SynthStyleFactory.voidinitialize()Called by UIManager when this look and feel is installed.booleanisNativeLookAndFeel()Returns false, SynthLookAndFeel is not a native look and feel.booleanisSupportedLookAndFeel()Returns true, SynthLookAndFeel is always supported.voidload(InputStream input, Class<?> resourceBase)Loads the set ofSynthStyles that will be used by thisSynthLookAndFeel.voidload(URL url)Loads the set ofSynthStyles that will be used by thisSynthLookAndFeel.static voidsetStyleFactory(SynthStyleFactory cache)Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.booleanshouldUpdateStyleOnAncestorChanged()Returns whether or not the UIs should update theirSynthStylesfrom theSynthStyleFactorywhen the ancestor of theJComponentchanges.protected booleanshouldUpdateStyleOnEvent(PropertyChangeEvent ev)Returns whether or not the UIs should update their styles when a particular event occurs.voiduninitialize()Called by UIManager when this look and feel is uninstalled.static voidupdateStyles(Component c)Updates the style associated withc, and all its children.- 
Methods declared in class javax.swing.plaf.basic.BasicLookAndFeelcreateAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound
 - 
Methods declared in class javax.swing.LookAndFeelgetDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
 
- 
 
- 
- 
- 
Method Detail- 
setStyleFactorypublic static void setStyleFactory(SynthStyleFactory cache) Sets the SynthStyleFactory that the UI classes provided by synth will use to obtain a SynthStyle.- Parameters:
- cache- SynthStyleFactory the UIs should use.
 
 - 
getStyleFactorypublic static SynthStyleFactory getStyleFactory() Returns the current SynthStyleFactory.- Returns:
- SynthStyleFactory
 
 - 
getStylepublic static SynthStyle getStyle(JComponent c, Region region) 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 for
- region- Identifies the region of the specified component
- Returns:
- SynthStyle to use.
 
 - 
updateStylespublic static void updateStyles(Component c) Updates the style associated withc, and all its children. This is a lighter version ofSwingUtilities.updateComponentTreeUI.- Parameters:
- c- Component to update style for.
 
 - 
getRegionpublic static Region getRegion(JComponent c) Returns the Region for the JComponentc.- Parameters:
- c- JComponent to fetch the Region for
- Returns:
- Region corresponding to c
 
 - 
createUIpublic static ComponentUI createUI(JComponent c) Creates the Synth look and feelComponentUIfor the passed inJComponent.- Parameters:
- c- JComponent to create the- ComponentUIfor
- Returns:
- ComponentUI to use for c
 
 - 
loadpublic void load(InputStream input, Class<?> resourceBase) throws ParseException 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 from
- resourceBase- used to resolve any images or other resources
- Throws:
- ParseException- if there is an error in parsing
- IllegalArgumentException- if input or resourceBase is- null
 
 - 
loadpublic void load(URL url) throws ParseException, IOException Loads 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.- Parameters:
- url- the- URLto load the set of- SynthStylefrom
- Throws:
- ParseException- if there is an error in parsing
- IllegalArgumentException- if synthSet is- null
- IOException- if synthSet cannot be opened as an- InputStream
- Since:
- 1.6
 
 - 
initializepublic void initialize() Called by UIManager when this look and feel is installed.- Overrides:
- initializein class- LookAndFeel
- See Also:
- LookAndFeel.uninitialize(),- UIManager.setLookAndFeel(javax.swing.LookAndFeel)
 
 - 
uninitializepublic void uninitialize() Called by UIManager when this look and feel is uninstalled.- Overrides:
- uninitializein class- LookAndFeel
- See Also:
- LookAndFeel.initialize(),- UIManager.setLookAndFeel(javax.swing.LookAndFeel)
 
 - 
getDefaultspublic UIDefaults getDefaults() Returns the defaults for this SynthLookAndFeel.- Overrides:
- getDefaultsin class- BasicLookAndFeel
- Returns:
- Defaults table.
- See Also:
- BasicLookAndFeel.initClassDefaults(javax.swing.UIDefaults),- BasicLookAndFeel.initSystemColorDefaults(javax.swing.UIDefaults),- BasicLookAndFeel.initComponentDefaults(javax.swing.UIDefaults)
 
 - 
isSupportedLookAndFeelpublic boolean isSupportedLookAndFeel() Returns true, SynthLookAndFeel is always supported.- Specified by:
- isSupportedLookAndFeelin class- LookAndFeel
- Returns:
- true.
- See Also:
- UIManager.setLookAndFeel(javax.swing.LookAndFeel)
 
 - 
isNativeLookAndFeelpublic boolean isNativeLookAndFeel() Returns false, SynthLookAndFeel is not a native look and feel.- Specified by:
- isNativeLookAndFeelin class- LookAndFeel
- Returns:
- false
 
 - 
getDescriptionpublic String getDescription() Returns a textual description of SynthLookAndFeel.- Specified by:
- getDescriptionin class- LookAndFeel
- Returns:
- textual description of synth.
 
 - 
getNamepublic String getName() Return a short string that identifies this look and feel.- Specified by:
- getNamein class- LookAndFeel
- Returns:
- a short string identifying this look and feel.
 
 - 
getIDpublic String getID() Return a string that identifies this look and feel.- Specified by:
- getIDin class- LookAndFeel
- Returns:
- a short string identifying this look and feel.
 
 - 
shouldUpdateStyleOnAncestorChangedpublic 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.
 
 - 
shouldUpdateStyleOnEventprotected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) Returns whether or not the UIs should update their styles when a particular event occurs.- Parameters:
- ev- a- PropertyChangeEvent
- Returns:
- whether or not the UIs should update their styles
- Since:
- 1.7
 
 
- 
 
-