java.lang.Object | |
↳ | javax.swing.text.StyleContext.NamedStyle |
A collection of attributes, typically used to represent character and paragraph styles. This is an implementation of MutableAttributeSet that can be observed if desired. These styles will take advantage of immutability while the sets are small enough, and may be substantially more efficient than something like SimpleAttributeSet.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
changeEvent | Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. | ||||||||||
listenerList | The change listeners for the model. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new named style.
| |||||||||||
Creates a new named style.
| |||||||||||
Creates a new named style, with a null name and parent.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds an attribute.
| |||||||||||
Adds a set of attributes to the element.
| |||||||||||
Adds a change listener.
| |||||||||||
Checks whether a given attribute name/value is defined.
| |||||||||||
Checks whether the element contains all the attributes.
| |||||||||||
Copies a set of attributes.
| |||||||||||
Gets the value of an attribute.
| |||||||||||
Gets the number of attributes that are defined.
| |||||||||||
Gets the names of all attributes.
| |||||||||||
Returns an array of all the
ChangeListener s added
to this NamedStyle with addChangeListener(). | |||||||||||
Return an array of all the listeners of the given type that
were added to this model.
| |||||||||||
Fetches the name of the style.
| |||||||||||
Gets attributes from the parent.
| |||||||||||
Checks whether a given attribute is defined.
| |||||||||||
Checks whether two attribute sets are equal.
| |||||||||||
Removes an attribute from the set.
| |||||||||||
Removes a set of attributes for the element.
| |||||||||||
Removes a set of attributes for the element.
| |||||||||||
Removes a change listener.
| |||||||||||
Changes the name of the style.
| |||||||||||
Sets the resolving parent.
| |||||||||||
Converts the style to a string.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notifies all listeners that have registered interest for
notification on this event type.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".
Creates a new named style.
name | the style name, null for unnamed |
---|---|
parent | the parent style, null if none |
Creates a new named style.
parent | the parent style, null if none |
---|
Creates a new named style, with a null name and parent.
Adds an attribute.
name | the non-null attribute name |
---|---|
value | the attribute value |
Adds a set of attributes to the element.
attr | the attributes to add |
---|
Adds a change listener.
l | the change listener |
---|
Checks whether a given attribute name/value is defined.
name | the non-null attribute name |
---|---|
value | the attribute value |
Checks whether the element contains all the attributes.
attrs | the attributes to check |
---|
Gets the value of an attribute.
attrName | the non-null attribute name |
---|
Gets the number of attributes that are defined.
Gets the names of all attributes.
Returns an array of all the ChangeListener
s added
to this NamedStyle with addChangeListener().
ChangeListener
s added or an empty
array if no listeners have been addedReturn an array of all the listeners of the given type that were added to this model.
Fetches the name of the style. A style is not required to be named, so null is returned if there is no name associated with the style.
Gets attributes from the parent. If not overriden, the resolving parent defaults to the parent element.
Checks whether a given attribute is defined.
attrName | the non-null attribute name |
---|
Checks whether two attribute sets are equal.
attr | the attribute set to check against |
---|
Removes an attribute from the set.
name | the non-null attribute name |
---|
Removes a set of attributes for the element.
attrs | the attributes |
---|
Removes a set of attributes for the element.
names | the attribute names |
---|
Removes a change listener.
l | the change listener |
---|
Changes the name of the style. Does nothing with a null name.
name | the new name |
---|
Sets the resolving parent.
parent | the parent, null if none |
---|
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.