java.lang.Object | ||
↳ | javax.swing.plaf.synth.SynthStyle | |
↳ | sun.swing.plaf.synth.DefaultSynthStyle |
Default implementation of SynthStyle. Has setters for the various SynthStyle methods. Many of the properties can be specified for all states, using SynthStyle directly, or a specific state using one of the StateInfo methods.
Beyond the constructor a subclass should override the addTo
and clone
methods, these are used when the Styles are being
merged into a resulting style.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DefaultSynthStyle.StateInfo | StateInfo represents Style information specific to the state of a component. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Nullary constructor, intended for subclassers.
| |||||||||||
Creates a new DefaultSynthStyle that is a copy of the passed in
style.
| |||||||||||
Creates a new DefaultSynthStyle.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Merges the contents of this Style with that of the passed in Style,
returning the resulting merged syle.
| |||||||||||
Creates a clone of this style.
| |||||||||||
Getter for a region specific style property.
| |||||||||||
Returns the color for the specified state.
| |||||||||||
Returns the style specific data.
| |||||||||||
Returns the default value for a particular property.
| |||||||||||
Returns the Font for the specified state.
| |||||||||||
Returns a SynthGraphicsUtils.
| |||||||||||
Returns the Insets.
| |||||||||||
Returns the Painter for the passed in Component.
| |||||||||||
Returns the best matching StateInfo for a particular state.
| |||||||||||
Returns the array of StateInfo's that that are used to specify
properties specific to a particular style.
| |||||||||||
Returns the value to initialize the opacity property of the Component
to.
| |||||||||||
Sets style specific values.
| |||||||||||
Sets the font that is used if there is no matching StateInfo, or
it does not define a font.
| |||||||||||
Sets the SynthGraphicsUtils that will be used for rendering.
| |||||||||||
Sets the insets.
| |||||||||||
Sets whether or not the JComponent should be opaque.
| |||||||||||
Sets the Painter to use for the border.
| |||||||||||
Sets the array of StateInfo's which are used to specify properties
specific to a particular style.
| |||||||||||
Returns a string representation of the object.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the color for the specified state.
| |||||||||||
Returns the color for the specified state.
| |||||||||||
Returns the font for the specified state.
| |||||||||||
Returns the font for the specified state.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Nullary constructor, intended for subclassers.
Creates a new DefaultSynthStyle that is a copy of the passed in style. Any StateInfo's of the passed in style are clonsed as well.
style | Style to duplicate |
---|
Creates a new DefaultSynthStyle.
insets | Insets for the Style |
---|---|
opaque | Whether or not the background is completely painted in an opaque color |
states | StateInfos describing properties per state |
data | Style specific data. |
Merges the contents of this Style with that of the passed in Style,
returning the resulting merged syle. Properties of this
DefaultSynthStyle
will take precedence over those of the
passed in DefaultSynthStyle
. For example, if this
style specifics a non-null font, the returned style will have its
font so to that regardless of the style
's font.
style | Style to add our styles to |
---|
Getter for a region specific style property.
state | SynthContext indentifying requestor |
---|---|
key | Property being requested. |
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(SynthContext, ColorType)
.
context | SynthContext identifying requester |
---|---|
type | Type of color being requested. |
Returns the default value for a particular property. This is only
invoked if this style doesn't define a property for key
.
key | Property being requested. |
---|
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(SynthContext)
is invoked.
state | SynthContext identifying requester |
---|
Returns a SynthGraphicsUtils.
context | SynthContext indentifying requestor |
---|
Returns the Insets. If to
is non-null the resulting
insets will be placed in it, otherwise a new Insets object will be
created and returned.
state | SynthContext identifying requester |
---|---|
to | Where to place Insets |
Returns the Painter for the passed in Component. This may return null.
ss | SynthContext indentifying requestor |
---|
Returns the best matching StateInfo for a particular state.
state | Component state. |
---|
Returns the array of StateInfo's that that are used to specify properties specific to a particular style.
Returns the value to initialize the opacity property of the Component to. A Style should NOT assume the opacity will remain this value, the developer may reset it or override it.
ss | SynthContext indentifying requestor |
---|
Sets style specific values. This does NOT copy the data, it assigns it directly to this Style.
data | Style specific values |
---|
Sets the font that is used if there is no matching StateInfo, or it does not define a font.
font | Font to use for rendering |
---|
Sets the SynthGraphicsUtils that will be used for rendering.
graphics | SynthGraphics |
---|
Sets whether or not the JComponent should be opaque.
opaque | Whether or not the JComponent should be opaque. |
---|
Sets the Painter to use for the border.
painter | Painter for the Border. |
---|
Sets the array of StateInfo's which are used to specify properties specific to a particular style.
states | StateInfos |
---|
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns the color for the specified state.
c | JComponent the style is associated with |
---|---|
id | Region identifier |
state | State of the region. |
type | Type of color being requested. |
Returns the color for the specified state. This should NOT call any
methods on the JComponent
.
context | SynthContext identifying requester |
---|---|
type | Type of color being requested. |
Returns the font for the specified state. This should NOT call any
method on the JComponent
.
context | SynthContext identifying requester |
---|
Returns the font for the specified state. This should NOT callback to the JComponent.
c | JComponent the style is associated with |
---|---|
id | Region identifier |
state | State of the region. |