This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.plaf.synth
class SynthLookAndFeel

java.lang.Object extended by javax.swing.LookAndFeel extended by javax.swing.plaf.basic.BasicLookAndFeel extended by javax.swing.plaf.synth.SynthLookAndFeel
All Implemented Interfaces:
Serializable

Most common way to construct:

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

          Return a string that identifies this look and feel.
 String

          Return a short string that identifies this look and feel.
static Region

          Returns the Region for the JComponent c.
static SynthStyle

          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 SynthStyles that will be used by this SynthLookAndFeel.
 void
load(URL url)

          Loads the set of SynthStyles that will be used by this SynthLookAndFeel.
static void

          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 javax.swing.LookAndFeel
getDefaults, getDescription, getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getID, getLayoutStyle, getName, getSupportsWindowDecorations, initialize, installBorder, installColors, installColorsAndFont, installProperty, isNativeLookAndFeel, isSupportedLookAndFeel, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninitialize, uninstallBorder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynthLookAndFeel

public SynthLookAndFeel()
Creates a SynthLookAndFeel.

For the returned SynthLookAndFeel to be useful you need to invoke load to specify the set of SynthStyles, or invoke setStyleFactory.

Method Detail

createUI

public static ComponentUI createUI(JComponent c)
Creates the Synth look and feel ComponentUI for the passed in JComponent.

Parameters:
c - JComponent to create the ComponentUI for
Returns:
ComponentUI to use for c

getDefaults

public UIDefaults getDefaults()
Returns the defaults for this SynthLookAndFeel.

Overrides:
getDefaults in class BasicLookAndFeel
Returns:
Defaults table.

getDescription

public String getDescription()
Returns a textual description of SynthLookAndFeel.

Overrides:
getDescription in class LookAndFeel
Returns:
textual description of synth.

getID

public String getID()
Return a string that identifies this look and feel.

Overrides:
getID in class LookAndFeel
Returns:
a short string identifying this look and feel.

getName

public String getName()
Return a short string that identifies this look and feel.

Overrides:
getName in class LookAndFeel
Returns:
a short string identifying this look and feel.

getRegion

public static Region getRegion(JComponent c)
Returns the Region for the JComponent c.

Parameters:
c - JComponent to fetch the Region for
Returns:
Region corresponding to c

getStyle

public 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.

getStyleFactory

public static SynthStyleFactory getStyleFactory()
Returns the current SynthStyleFactory.

Returns:
SynthStyleFactory

initialize

public void initialize()
Called by UIManager when this look and feel is installed.

Overrides:
initialize in class BasicLookAndFeel

isNativeLookAndFeel

public boolean isNativeLookAndFeel()
Returns false, SynthLookAndFeel is not a native look and feel.

Overrides:
isNativeLookAndFeel in class LookAndFeel
Returns:
false

isSupportedLookAndFeel

public boolean isSupportedLookAndFeel()
Returns true, SynthLookAndFeel is always supported.

Overrides:
isSupportedLookAndFeel in class LookAndFeel
Returns:
true.

load

public void load(InputStream input,
                 Class resourceBase)
          throws ParseException
Loads the set of 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

load

public void load(URL url)
          throws ParseException,
                 IOException
Loads the set of SynthStyles 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.

Parameters:
url - the URL to load the set of SynthStyle from
Throws:
ParseException - if there is an error in parsing
IOException - if synthSet cannot be opened as an InputStream

setStyleFactory

public 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.

shouldUpdateStyleOnAncestorChanged

public boolean shouldUpdateStyleOnAncestorChanged()
Returns whether or not the UIs should update their 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 SynthStyles from the SynthStyleFactory when the ancestor changed.

uninitialize

public void uninitialize()
Called by UIManager when this look and feel is uninstalled.

Overrides:
uninitialize in class BasicLookAndFeel

updateStyles

public static void updateStyles(Component c)
Updates the style associated with c, and all its children. This is a lighter version of SwingUtilities.updateComponentTreeUI.

Parameters:
c - Component to update style for.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.