Class SynthLookAndFeel
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NimbusLookAndFeel
public class SynthLookAndFeel extends BasicLookAndFeel
load(InputStream, Class) method, or provide your own SynthStyleFactory to setStyleFactory(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
| Constructor | Description |
|---|---|
SynthLookAndFeel() |
Creates a SynthLookAndFeel. |
Method Summary
| 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 SynthStyles that will be used by this SynthLookAndFeel. |
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. |
Methods declared in class BasicLookAndFeel
createAudioAction, getAudioActionMap, initClassDefaults, initComponentDefaults, initSystemColorDefaults, loadSystemColors, playSound | Modifier and Type | Method | Description |
|---|---|---|
protected Action |
createAudioAction |
Creates and returns an Action used to play a sound. |
protected ActionMap |
getAudioActionMap() |
Returns an ActionMap containing the audio actions for this look and feel. |
protected void |
initClassDefaults |
Populates table with mappings from uiClassID to the fully qualified name of the ui class. |
protected void |
initComponentDefaults |
Populates table with the defaults for the basic look and feel. |
protected void |
initSystemColorDefaults |
Populates table with system colors. |
protected void |
loadSystemColors |
Populates table with the name-color pairs in systemColors. |
protected void |
playSound |
If necessary, invokes actionPerformed on audioAction to play a sound. |
Methods declared in class LookAndFeel
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder | Modifier and Type | Method | Description |
|---|---|---|
static Object |
getDesktopPropertyValue |
Returns the value of the specified system desktop property by invoking Toolkit.getDefaultToolkit().getDesktopProperty(). |
Icon |
getDisabledIcon |
Returns an Icon with a disabled appearance. |
Icon |
getDisabledSelectedIcon |
Returns an Icon for use by disabled components that are also selected. |
LayoutStyle |
getLayoutStyle() |
Returns the LayoutStyle for this look and feel. |
boolean |
getSupportsWindowDecorations() |
Returns true if the LookAndFeel returned RootPaneUI instances support providing Window decorations in a JRootPane. |
static void |
installBorder |
Convenience method for setting a component's border property with a value from the defaults. |
static void |
installColors |
Convenience method for setting a component's foreground and background color properties with values from the defaults. |
static void |
installColorsAndFont |
Convenience method for setting a component's foreground, background and font properties with values from the defaults. |
static void |
installProperty |
Convenience method for installing a property with the specified name and value on a component if that property has not already been set by the developer. |
static void |
loadKeyBindings |
Populates an InputMap with the specified bindings. |
static ComponentInputMap |
makeComponentInputMap |
Creates a ComponentInputMapUIResource from keys. |
static Object |
makeIcon |
Creates and returns a UIDefault.LazyValue that loads an image. |
static InputMap |
makeInputMap |
Creates an InputMapUIResource from keys. |
static JTextComponent.KeyBinding[] |
makeKeyBindings |
Convenience method for building an array of
KeyBindings. |
void |
provideErrorFeedback |
Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus. |
String |
toString() |
Returns a string that displays and identifies this object's properties. |
static void |
uninstallBorder |
Convenience method for uninstalling a border. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
SynthLookAndFeel
public SynthLookAndFeel()
For the returned SynthLookAndFeel to be useful you need to invoke load to specify the set of SynthStyles, or invoke setStyleFactory.
- See Also:
Method Details
setStyleFactory
public static void setStyleFactory(SynthStyleFactory cache)
- Parameters:
-
cache- SynthStyleFactory the UIs should use.
getStyleFactory
public static SynthStyleFactory getStyleFactory()
- Returns:
- SynthStyleFactory
getStyle
public static SynthStyle getStyle(JComponent c, Region region)
- Parameters:
-
c- JComponent to get the SynthStyle for -
region- Identifies the region of the specified component - Returns:
- SynthStyle to use.
updateStyles
public static void updateStyles(Component c)
c, and all its children. This is a lighter version of SwingUtilities.updateComponentTreeUI.- Parameters:
-
c- Component to update style for.
getRegion
public static Region getRegion(JComponent c)
c.- Parameters:
-
c- JComponent to fetch the Region for - Returns:
- Region corresponding to
c
createUI
public static ComponentUI createUI(JComponent c)
ComponentUI for the passed in JComponent.- Parameters:
-
c- JComponent to create theComponentUIfor - Returns:
- ComponentUI to use for
c
load
public void load(InputStream input, Class<?> resourceBase) throws ParseException
SynthStyles 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.- 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 isnull
initialize
public void initialize()
- Overrides:
-
initializein classLookAndFeel - See Also:
uninitialize
public void uninitialize()
- Overrides:
-
uninitializein classLookAndFeel - See Also:
getDefaults
public UIDefaults getDefaults()
- Overrides:
-
getDefaultsin classBasicLookAndFeel - Returns:
- Defaults table.
- See Also:
isSupportedLookAndFeel
public boolean isSupportedLookAndFeel()
- Specified by:
-
isSupportedLookAndFeelin classLookAndFeel - Returns:
- true.
- See Also:
isNativeLookAndFeel
public boolean isNativeLookAndFeel()
- Specified by:
-
isNativeLookAndFeelin classLookAndFeel - Returns:
- false
getDescription
public String getDescription()
- Specified by:
-
getDescriptionin classLookAndFeel - Returns:
- textual description of synth.
getName
public String getName()
- Specified by:
-
getNamein classLookAndFeel - Returns:
- a short string identifying this look and feel.
getID
public String getID()
- Specified by:
-
getIDin classLookAndFeel - Returns:
- a short string identifying this look and feel.
shouldUpdateStyleOnAncestorChanged
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.- Returns:
- whether or not the UIs should update their
SynthStylesfrom theSynthStyleFactorywhen the ancestor changed.
shouldUpdateStyleOnEvent
protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev)
- Parameters:
-
ev- aPropertyChangeEvent - Returns:
- whether or not the UIs should update their styles
- Since:
- 1.7
© 1993, 2025, 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.