javax.swing.plaf.synth

Class SynthLookAndFeel

Implemented Interfaces:
Serializable

public class SynthLookAndFeel
extends BasicLookAndFeel

A look and feel that can be customized either by providing a file to load(InputStream,Class) or by setting a SynthStyleFactory using setStyleFactory(SynthStyleFactory).
Since:
1.5
See Also:
Serialized Form

Constructor Summary

SynthLookAndFeel()
Creates a new instance of SynthLookAndFeel.

Method Summary

static ComponentUI
createUI(JComponent c)
Creates the Synth look and feel component UI instance for the given component.
UIDefaults
getDefaults()
Returns the UI defaults of this look and feel.
String
getDescription()
Returns a textual description of the Synth look and feel.
String
getID()
Returns the ID of the Synth look and feel.
String
getName()
Returns the name of the Synth look and feel.
static Region
getRegion(JComponent c)
Returns the region for a given Swing component.
static SynthStyle
getStyle(JComponent c, Region r)
Returns the style for the specified component and region.
static SynthStyleFactory
getStyleFactory()
Returns the current style factory that the UI classes of Synth will use to load their sets of styles.
void
initialize()
Initializes this look and feel.
boolean
isNativeLookAndFeel()
Returns false since the Synth look and feel is not a native look and feel.
boolean
isSupportedLookAndFeel()
Returns true since the Synth look and feel is always a supported look and feel.
void
load(InputStream in, Class resourceBase)
Loads a set of SynthStyles that are used for the look and feel of the components.
static void
setStyleFactory(SynthStyleFactory sf)
Sets the style factory that the UI classes of Synth will use to load their sets of styles.
boolean
shouldUpdateStyleOnAncestorChanged()
FIXME: DOCUMENT ME!
void
uninitialize()
Uninitializes the look and feel.
static void
updateStyles(Component c)
Updates all style information of the component and it's children.

Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel

createAudioAction, getAudioActionMap, getDefaults, initClassDefaults, initComponentDefaults, initSystemColorDefaults, initialize, loadSystemColors, playSound, uninitialize

Methods inherited from class javax.swing.LookAndFeel

getDefaults, getDescription, getDesktopPropertyValue, getID, 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, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

SynthLookAndFeel

public SynthLookAndFeel()
Creates a new instance of SynthLookAndFeel. In order to use the Synth look and feel you either need to call load(InputStream,Class) to load a set of styles from an XML file, or you need to call setStyleFactory(SynthStyleFactory) to provide your own style factory.

Method Details

createUI

public static ComponentUI createUI(JComponent c)
            throws gnu.classpath.NotImplementedException
Creates the Synth look and feel component UI instance for the given component.
Parameters:
c - the component for which to create a UI instance
Returns:
the Synth look and feel component UI instance for the given component

getDefaults

public UIDefaults getDefaults()
            throws gnu.classpath.NotImplementedException
Returns the UI defaults of this look and feel.
Overrides:
getDefaults in interface BasicLookAndFeel
Returns:
the UI defaults of this look and feel

getDescription

public String getDescription()
Returns a textual description of the Synth look and feel. This returns "Synth look and feel".
Overrides:
getDescription in interface LookAndFeel
Returns:
a textual description of the Synth look and feel

getID

public String getID()
Returns the ID of the Synth look and feel. This returns "Synth".
Overrides:
getID in interface LookAndFeel
Returns:
the ID of the Synth look and feel

getName

public String getName()
Returns the name of the Synth look and feel. This returns "Synth look and feel".
Overrides:
getName in interface LookAndFeel
Returns:
the name of the Synth look and feel

getRegion

public static Region getRegion(JComponent c)
            throws gnu.classpath.NotImplementedException
Returns the region for a given Swing component.
Parameters:
c - the Swing component for which to fetch the region
Returns:
the region for a given Swing component

getStyle

public static SynthStyle getStyle(JComponent c,
                                  Region r)
Returns the style for the specified component and region.
Parameters:
c - the component for which to return the style
r - the region of the component for which to return the style
Returns:
the style for the specified component and region

getStyleFactory

public static SynthStyleFactory getStyleFactory()
Returns the current style factory that the UI classes of Synth will use to load their sets of styles.
Returns:
the current style factory

initialize

public void initialize()
            throws gnu.classpath.NotImplementedException
Initializes this look and feel.
Overrides:
initialize in interface BasicLookAndFeel

isNativeLookAndFeel

public boolean isNativeLookAndFeel()
Returns false since the Synth look and feel is not a native look and feel.
Overrides:
isNativeLookAndFeel in interface LookAndFeel
Returns:
false

isSupportedLookAndFeel

public boolean isSupportedLookAndFeel()
Returns true since the Synth look and feel is always a supported look and feel.
Overrides:
isSupportedLookAndFeel in interface LookAndFeel
Returns:
true

load

public void load(InputStream in,
                 Class resourceBase)
            throws ParseException,
                   IllegalArgumentException,
                   gnu.classpath.NotImplementedException
Loads a set of SynthStyles that are used for the look and feel of the components. The resourceBase parameter is used to resolve references against, like icons and other files.
Parameters:
in - the input stream from where to load the styles
resourceBase - the base against which references are resolved.
Throws:
ParseException - if the input stream cannot be parsed
IllegalArgumentException - if one of the parameters is null

setStyleFactory

public static void setStyleFactory(SynthStyleFactory sf)
Sets the style factory that the UI classes of Synth will use to load their sets of styles.
Parameters:
sf - the style factory to set

shouldUpdateStyleOnAncestorChanged

public boolean shouldUpdateStyleOnAncestorChanged()
            throws gnu.classpath.NotImplementedException
FIXME: DOCUMENT ME!
Returns:
FIXME

uninitialize

public void uninitialize()
            throws gnu.classpath.NotImplementedException
Uninitializes the look and feel.
Overrides:
uninitialize in interface BasicLookAndFeel

updateStyles

public static void updateStyles(Component c)
            throws gnu.classpath.NotImplementedException
Updates all style information of the component and it's children.
Parameters:
c - the componenent for which to update the style

SynthLookAndFeel.java -- A skinnable Swing look and feel Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.