Style (Java Platform SE 8 ) (original) (raw)
- All Superinterfaces:
AttributeSet, MutableAttributeSet
All Known Implementing Classes:
StyleContext.NamedStyle
public interface Style
extends MutableAttributeSet
A collection of attributes to associate with an element in a document. Since these are typically used to associate character and paragraph styles with the element, operations for this are provided. Other customized attributes that get associated with the element will effectively be name-value pairs that live in a hierarchy and if a name (key) is not found locally, the request is forwarded to the parent. Commonly used attributes are separated out to facilitate alternative implementations that are more efficient.
Nested Class Summary
* ### Nested classes/interfaces inherited from interface javax.swing.text.[AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text") `[AttributeSet.CharacterAttribute](../../../javax/swing/text/AttributeSet.CharacterAttribute.html "interface in javax.swing.text"), [AttributeSet.ColorAttribute](../../../javax/swing/text/AttributeSet.ColorAttribute.html "interface in javax.swing.text"), [AttributeSet.FontAttribute](../../../javax/swing/text/AttributeSet.FontAttribute.html "interface in javax.swing.text"), [AttributeSet.ParagraphAttribute](../../../javax/swing/text/AttributeSet.ParagraphAttribute.html "interface in javax.swing.text")`
Field Summary
* ### Fields inherited from interface javax.swing.text.[AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text") `[NameAttribute](../../../javax/swing/text/AttributeSet.html#NameAttribute), [ResolveAttribute](../../../javax/swing/text/AttributeSet.html#ResolveAttribute)`
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type Method Description void addChangeListener(ChangeListener l) Adds a listener to track whenever an attribute has been changed. String getName() Fetches the name of the style. void removeChangeListener(ChangeListener l) Removes a listener that was tracking attribute changes. * ### Methods inherited from interface javax.swing.text.[MutableAttributeSet](../../../javax/swing/text/MutableAttributeSet.html "interface in javax.swing.text") `[addAttribute](../../../javax/swing/text/MutableAttributeSet.html#addAttribute-java.lang.Object-java.lang.Object-), [addAttributes](../../../javax/swing/text/MutableAttributeSet.html#addAttributes-javax.swing.text.AttributeSet-), [removeAttribute](../../../javax/swing/text/MutableAttributeSet.html#removeAttribute-java.lang.Object-), [removeAttributes](../../../javax/swing/text/MutableAttributeSet.html#removeAttributes-javax.swing.text.AttributeSet-), [removeAttributes](../../../javax/swing/text/MutableAttributeSet.html#removeAttributes-java.util.Enumeration-), [setResolveParent](../../../javax/swing/text/MutableAttributeSet.html#setResolveParent-javax.swing.text.AttributeSet-)` * ### Methods inherited from interface javax.swing.text.[AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text") `[containsAttribute](../../../javax/swing/text/AttributeSet.html#containsAttribute-java.lang.Object-java.lang.Object-), [containsAttributes](../../../javax/swing/text/AttributeSet.html#containsAttributes-javax.swing.text.AttributeSet-), [copyAttributes](../../../javax/swing/text/AttributeSet.html#copyAttributes--), [getAttribute](../../../javax/swing/text/AttributeSet.html#getAttribute-java.lang.Object-), [getAttributeCount](../../../javax/swing/text/AttributeSet.html#getAttributeCount--), [getAttributeNames](../../../javax/swing/text/AttributeSet.html#getAttributeNames--), [getResolveParent](../../../javax/swing/text/AttributeSet.html#getResolveParent--), [isDefined](../../../javax/swing/text/AttributeSet.html#isDefined-java.lang.Object-), [isEqual](../../../javax/swing/text/AttributeSet.html#isEqual-javax.swing.text.AttributeSet-)`
Method Detail
* #### getName [String](../../../java/lang/String.html "class in java.lang") getName() 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. Returns: the name * #### addChangeListener void addChangeListener([ChangeListener](../../../javax/swing/event/ChangeListener.html "interface in javax.swing.event") l) Adds a listener to track whenever an attribute has been changed. Parameters: `l` \- the change listener * #### removeChangeListener void removeChangeListener([ChangeListener](../../../javax/swing/event/ChangeListener.html "interface in javax.swing.event") l) Removes a listener that was tracking attribute changes. Parameters: `l` \- the change listener
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.