APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.plaf.synth

public abstract Class SynthStyle

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.java.swing.plaf.gtk.GTKStyle, sun.swing.plaf.synth.DefaultSynthStyle, javax.swing.plaf.nimbus.NimbusStyle
Imports
java.awt.*, javax.swing.*, javax.swing.border.Border, javax.swing.plaf.UIResource, javax.swing.plaf.basic.BasicLookAndFeel, javax.swing.text.DefaultEditorKit, .JTextComponent, java.util.HashMap, .Map, sun.swing.SwingUtilities2

SynthStyle is a set of style properties. Each SynthUI references at least one SynthStyle that is obtained using a SynthStyleFactory. You typically don't need to interact with this class directly, rather you will load a Synth File Format file into SynthLookAndFeel that will create a set of SynthStyles.
Author
Scott Violet
Since
1.5
See Also
SynthLookAndFeel, SynthStyleFactory

Field Summary

Modifier and TypeField and Description
private static Map<Object, Object>
DEFAULT_VALUES

Contains the default values for certain properties.

private static final SynthGraphicsUtils
SYNTH_GRAPHICS

Shared SynthGraphics.

Constructor Summary

AccessConstructor and Description
public
SynthStyle()

Constructs a SynthStyle.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

Value of the named property
get
(SynthContext
SynthContext identifying requester
context
,
Object
Property being requested.
key
)

Getter for a region specific style property.

public boolean

Returns:

Value of the named property
getBoolean
(SynthContext
SynthContext identifying requester
context
,
Object
Property being requested.
key
,
boolean
Value to return if the property has not been specified, or is not a Boolean
defaultValue
)

Convenience method to get a specific style property whose value is an Boolean.

public Color

Returns:

Color
getColor
(SynthContext
SynthContext identifying requester
context
,
ColorType
Type of color being requested.
type
)

Returns the color for the specified state.

protected abstract Color

Returns:

Color to render with
getColorForState
(SynthContext
SynthContext identifying requester
context
,
ColorType
Type of color being requested.
type
)

Returns the color for the specified state.

private static Object
getDefaultValue(Object key)

Returns the default value for the specified property, or null if there is no default for the specified value.

public Font

Returns:

Font to render with
getFont
(SynthContext
SynthContext identifying requester
context
)

Returns the Font for the specified state.

protected abstract Font

Returns:

Font to render with
getFontForState
(SynthContext
SynthContext identifying requester
context
)

Returns the font for the specified state.

public SynthGraphicsUtils

Returns:

SynthGraphicsUtils
getGraphicsUtils
(SynthContext
SynthContext identifying requester
context
)

Returns the SynthGraphicUtils for the specified context.

public Icon

Returns:

Value of the named property, or null if not specified
getIcon
(SynthContext
SynthContext identifying requester
context
,
Object
Property being requested.
key
)

Convenience method to get a specific style property whose value is an Icon.

public Insets

Returns:

Sizing Insets.
getInsets
(SynthContext
SynthContext identifying requester
context
,
Insets
Insets to place return value in.
insets
)

Returns the Insets that are used to calculate sizing information.

public int

Returns:

Value of the named property
getInt
(SynthContext
SynthContext identifying requester
context
,
Object
Property being requested.
key
,
int
Value to return if the property has not been specified, or is not a Number
defaultValue
)

Convenience method to get a specific style property whose value is a Number.

public SynthPainter

Returns:

SynthPainter to use
getPainter
(SynthContext
SynthContext identifying requester
context
)

Returns the SynthPainter that will be used for painting.

public String

Returns:

Value of the named property
getString
(SynthContext
SynthContext identifying requester
context
,
Object
Property being requested.
key
,
String
Value to return if the property has not been specified, or is not a String
defaultValue
)

Convenience method to get a specific style property whose value is a String.

pack-priv void
public void
installDefaults(SynthContext
SynthContext identifying component to install properties to.
context
)

Installs the necessary state from this Style on the JComponent from context.

public boolean

Returns:

true if region is opaque.
isOpaque
(SynthContext
SynthContext identifying requester
context
)

Returns true if the region is opaque.

private static void
populateDefaultValues()

Adds the default values that we know about to DEFAULT_VALUES.

public void
uninstallDefaults(SynthContext
SynthContext identifying component to install properties to.
context
)

Uninstalls any state that this style installed on the JComponent from context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_VALUESback to summary
private static Map<Object, Object> DEFAULT_VALUES

Contains the default values for certain properties.

SYNTH_GRAPHICSback to summary
private static final SynthGraphicsUtils SYNTH_GRAPHICS

Shared SynthGraphics.

Constructor Detail

SynthStyleback to summary
public SynthStyle()

Constructs a SynthStyle.

Method Detail

getback to summary
public Object get(SynthContext context, Object key)

Getter for a region specific style property.

Parameters
context:SynthContext

SynthContext identifying requester

key:Object

Property being requested.

Returns:Object

Value of the named property

getBooleanback to summary
public boolean getBoolean(SynthContext context, Object key, boolean defaultValue)

Convenience method to get a specific style property whose value is an Boolean.

Parameters
context:SynthContext

SynthContext identifying requester

key:Object

Property being requested.

defaultValue:boolean

Value to return if the property has not been specified, or is not a Boolean

Returns:boolean

Value of the named property

getColorback to summary
public Color getColor(SynthContext context, ColorType type)

Returns the color for the specified state. This gives precedence to foreground and background of the JComponent. If the Color from the JComponent is not appropriate, or not used, this will invoke getColorForState. Subclasses should generally not have to override this, instead override getColorForState.

Parameters
context:SynthContext

SynthContext identifying requester

type:ColorType

Type of color being requested.

Returns:Color

Color

getColorForStateback to summary
protected abstract Color getColorForState(SynthContext context, ColorType type)

Returns the color for the specified state. This should NOT call any methods on the JComponent.

Parameters
context:SynthContext

SynthContext identifying requester

type:ColorType

Type of color being requested.

Returns:Color

Color to render with

getDefaultValueback to summary
private static Object getDefaultValue(Object key)

Returns the default value for the specified property, or null if there is no default for the specified value.

getFontback to summary
public Font getFont(SynthContext context)

Returns the Font for the specified state. This redirects to the JComponent from the context as necessary. If this does not redirect to the JComponent getFontForState is invoked.

Parameters
context:SynthContext

SynthContext identifying requester

Returns:Font

Font to render with

getFontForStateback to summary
protected abstract Font getFontForState(SynthContext context)

Returns the font for the specified state. This should NOT call any method on the JComponent.

Parameters
context:SynthContext

SynthContext identifying requester

Returns:Font

Font to render with

getGraphicsUtilsback to summary
public SynthGraphicsUtils getGraphicsUtils(SynthContext context)

Returns the SynthGraphicUtils for the specified context.

Parameters
context:SynthContext

SynthContext identifying requester

Returns:SynthGraphicsUtils

SynthGraphicsUtils

getIconback to summary
public Icon getIcon(SynthContext context, Object key)

Convenience method to get a specific style property whose value is an Icon.

Parameters
context:SynthContext

SynthContext identifying requester

key:Object

Property being requested.

Returns:Icon

Value of the named property, or null if not specified

getInsetsback to summary
public Insets getInsets(SynthContext context, Insets insets)

Returns the Insets that are used to calculate sizing information.

Parameters
context:SynthContext

SynthContext identifying requester

insets:Insets

Insets to place return value in.

Returns:Insets

Sizing Insets.

getIntback to summary
public int getInt(SynthContext context, Object key, int defaultValue)

Convenience method to get a specific style property whose value is a Number. If the value is a Number, intValue is returned, otherwise defaultValue is returned.

Parameters
context:SynthContext

SynthContext identifying requester

key:Object

Property being requested.

defaultValue:int

Value to return if the property has not been specified, or is not a Number

Returns:int

Value of the named property

getPainterback to summary
public SynthPainter getPainter(SynthContext context)

Returns the SynthPainter that will be used for painting. This may return null.

Parameters
context:SynthContext

SynthContext identifying requester

Returns:SynthPainter

SynthPainter to use

getStringback to summary
public String getString(SynthContext context, Object key, String defaultValue)

Convenience method to get a specific style property whose value is a String.

Parameters
context:SynthContext

SynthContext identifying requester

key:Object

Property being requested.

defaultValue:String

Value to return if the property has not been specified, or is not a String

Returns:String

Value of the named property

installDefaultsback to summary
pack-priv void installDefaults(SynthContext context, SynthUI ui)
installDefaultsback to summary
public void installDefaults(SynthContext context)

Installs the necessary state from this Style on the JComponent from context.

Parameters
context:SynthContext

SynthContext identifying component to install properties to.

isOpaqueback to summary
public boolean isOpaque(SynthContext context)

Returns true if the region is opaque.

Parameters
context:SynthContext

SynthContext identifying requester

Returns:boolean

true if region is opaque.

populateDefaultValuesback to summary
private static void populateDefaultValues()

Adds the default values that we know about to DEFAULT_VALUES.

uninstallDefaultsback to summary
public void uninstallDefaults(SynthContext context)

Uninstalls any state that this style installed on the JComponent from context.

Styles should NOT depend upon this being called, in certain cases it may never be called.

Parameters
context:SynthContext

SynthContext identifying component to install properties to.