Serializable, AttributeSet, MutableAttributeSet, Style
StyleContextpublic class StyleContext.NamedStyle extends Object implements Style, Serializable
 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 JavaBeans has been added to the java.beans package. Please see XMLEncoder.
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
| Modifier and Type | Field | Description | 
|---|---|---|
| protected ChangeEvent | changeEvent | Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. | 
| protected EventListenerList | listenerList | The change listeners for the model. | 
NameAttribute, ResolveAttribute
| Constructor | Description | 
|---|---|
| NamedStyle() | Creates a new named style, with a null name and parent. | 
| NamedStyle | Creates a new named style. | 
| NamedStyle | Creates a new named style. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| void | addAttribute | Adds an attribute. | 
| void | addAttributes | Adds a set of attributes to the element. | 
| void | addChangeListener | Adds a change listener. | 
| boolean | containsAttribute | Checks whether a given attribute name/value is defined. | 
| boolean | containsAttributes | Checks whether the element contains all the attributes. | 
| AttributeSet | copyAttributes() | Copies a set of attributes. | 
| protected void | fireStateChanged() | Notifies all listeners that have registered interest for notification on this event type. | 
| Object | getAttribute | Gets the value of an attribute. | 
| int | getAttributeCount() | Gets the number of attributes that are defined. | 
| Enumeration | getAttributeNames() | Gets the names of all attributes. | 
| ChangeListener[] | getChangeListeners() | Returns an array of all the  ChangeListeners added to this NamedStyle with addChangeListener(). | 
| <T extends EventListener> | getListeners | Return an array of all the listeners of the given type that were added to this model. | 
| String | getName() | Fetches the name of the style. | 
| AttributeSet | getResolveParent() | Gets attributes from the parent. | 
| boolean | isDefined | Checks whether a given attribute is defined. | 
| boolean | isEqual | Checks whether two attribute sets are equal. | 
| void | removeAttribute | Removes an attribute from the set. | 
| void | removeAttributes | Removes a set of attributes for the element. | 
| void | removeAttributes | Removes a set of attributes for the element. | 
| void | removeChangeListener | Removes a change listener. | 
| void | setName | Changes the name of the style. | 
| void | setResolveParent | Sets the resolving parent. | 
| String | toString() | Converts the style to a string. | 
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
public NamedStyle(String name, Style parent)
name - the style name, null for unnamedparent - the parent style, null if nonepublic NamedStyle(Style parent)
parent - the parent style, null if nonepublic NamedStyle()
public String toString()
public String getName()
public void setName(String name)
name - the new namepublic void addChangeListener(ChangeListener l)
addChangeListener in interface Style
l - the change listenerpublic void removeChangeListener(ChangeListener l)
removeChangeListener in interface Style
l - the change listenerpublic ChangeListener[] getChangeListeners()
ChangeListeners added to this NamedStyle with addChangeListener().ChangeListeners added or an empty array if no listeners have been addedprotected void fireStateChanged()
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
T - the listener typelistenerType - the type of listeners requestedpublic int getAttributeCount()
getAttributeCount in interface AttributeSet
public boolean isDefined(Object attrName)
isDefined in interface AttributeSet
attrName - the non-null attribute namepublic boolean isEqual(AttributeSet attr)
isEqual in interface AttributeSet
attr - the attribute set to check againstpublic AttributeSet copyAttributes()
copyAttributes in interface AttributeSet
public Object getAttribute(Object attrName)
getAttribute in interface AttributeSet
attrName - the non-null attribute namepublic Enumeration<?> getAttributeNames()
getAttributeNames in interface AttributeSet
public boolean containsAttribute(Object name, Object value)
containsAttribute in interface AttributeSet
name - the non-null attribute namevalue - the attribute valuepublic boolean containsAttributes(AttributeSet attrs)
containsAttributes in interface AttributeSet
attrs - the attributes to checkpublic AttributeSet getResolveParent()
getResolveParent in interface AttributeSet
public void addAttribute(Object name, Object value)
addAttribute in interface MutableAttributeSet
name - the non-null attribute namevalue - the attribute valuepublic void addAttributes(AttributeSet attr)
addAttributes in interface MutableAttributeSet
attr - the attributes to addpublic void removeAttribute(Object name)
removeAttribute in interface MutableAttributeSet
name - the non-null attribute namepublic void removeAttributes(Enumeration<?> names)
removeAttributes in interface MutableAttributeSet
names - the attribute namespublic void removeAttributes(AttributeSet attrs)
removeAttributes in interface MutableAttributeSet
attrs - the attributespublic void setResolveParent(AttributeSet parent)
setResolveParent in interface MutableAttributeSet
parent - the parent, null if none
    © 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/text/StyleContext.NamedStyle.html