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

public Class SynthContext

extends Object
Class Inheritance
Imports
javax.swing.JComponent

An immutable transient object containing contextual information about a Region. A SynthContext should only be considered valid for the duration of the method it is passed to. In other words you should not cache a SynthContext that is passed to you and expect it to remain valid.
Author
Scott Violet
Since
1.5

Field Summary

Modifier and TypeField and Description
private JComponent
private Region
private int
private SynthStyle

Constructor Summary

AccessConstructor and Description
private
public
SynthContext(JComponent
JComponent
component
,
Region
Identifies the portion of the JComponent
region
,
SynthStyle
Style associated with the component
style
,
int
State of the component as defined in SynthConstants.
state
)

Creates a SynthContext with the specified values.

Method Summary

Modifier and TypeMethod and Description
public JComponent

Returns:

Hosting Component
getComponent
()

Returns the hosting component containing the region.

public int

Returns:

State of Component
getComponentState
()

Returns the state of the widget, which is a bitmask of the values defined in SynthConstants.

pack-priv static SynthContext
getContext(JComponent c, SynthStyle style, int state)

pack-priv static SynthContext
getContext(JComponent component, Region region, SynthStyle style, int state)

pack-priv SynthPainter
getPainter()

Convenience method to get the Painter from the current SynthStyle.

public Region

Returns:

Region of the hosting component
getRegion
()

Returns the Region identifying this state.

public SynthStyle

Returns:

SynthStyle associated with the region.
getStyle
()

Returns the style associated with this Region.

pack-priv boolean
isSubregion()

A convenience method for getRegion().isSubregion().

pack-priv void
setComponentState(int state)

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

componentback to summary
private JComponent component
regionback to summary
private Region region
stateback to summary
private int state
styleback to summary
private SynthStyle style

Constructor Detail

SynthContextback to summary
private SynthContext()
SynthContextback to summary
public SynthContext(JComponent component, Region region, SynthStyle style, int state)

Creates a SynthContext with the specified values. This is meant for subclasses and custom UI implementors. You very rarely need to construct a SynthContext, though some methods will take one.

Parameters
component:JComponent

JComponent

region:Region

Identifies the portion of the JComponent

style:SynthStyle

Style associated with the component

state:int

State of the component as defined in SynthConstants.

Exceptions
NullPointerException:
if component, region of style is null.

Method Detail

getComponentback to summary
public JComponent getComponent()

Returns the hosting component containing the region.

Returns:JComponent

Hosting Component

getComponentStateback to summary
public int getComponentState()

Returns the state of the widget, which is a bitmask of the values defined in SynthConstants. A region will at least be in one of ENABLED, MOUSE_OVER, PRESSED or DISABLED.

Returns:int

State of Component

See Also
SynthConstants
getContextback to summary
pack-priv static SynthContext getContext(JComponent c, SynthStyle style, int state)
getContextback to summary
pack-priv static SynthContext getContext(JComponent component, Region region, SynthStyle style, int state)
getPainterback to summary
pack-priv SynthPainter getPainter()

Convenience method to get the Painter from the current SynthStyle. This will NEVER return null.

getRegionback to summary
public Region getRegion()

Returns the Region identifying this state.

Returns:Region

Region of the hosting component

getStyleback to summary
public SynthStyle getStyle()

Returns the style associated with this Region.

Returns:SynthStyle

SynthStyle associated with the region.

isSubregionback to summary
pack-priv boolean isSubregion()

A convenience method for getRegion().isSubregion().

setComponentStateback to summary
pack-priv void setComponentState(int state)
setStyleback to summary
pack-priv void setStyle(SynthStyle style)