Serializable
, Cloneable
, AttributeSet
, MutableAttributeSet
public class SimpleAttributeSet extends Object implements MutableAttributeSet, Serializable, Cloneable
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 |
---|---|---|
static final AttributeSet |
EMPTY |
An empty attribute set. |
NameAttribute, ResolveAttribute
Constructor | Description |
---|---|
SimpleAttributeSet() |
Creates a new attribute set. |
SimpleAttributeSet |
Creates a new attribute set based on a supplied set of attributes. |
Modifier and Type | Method | Description |
---|---|---|
void |
addAttribute |
Adds an attribute to the list. |
void |
addAttributes |
Adds a set of attributes to the list. |
Object |
clone() |
Clones a set of attributes. |
boolean |
containsAttribute |
Checks whether the attribute list contains a specified attribute name/value pair. |
boolean |
containsAttributes |
Checks whether the attribute list contains all the specified name/value pairs. |
AttributeSet |
copyAttributes() |
Makes a copy of the attributes. |
boolean |
equals |
Compares this object to the specified object. |
Object |
getAttribute |
Gets the value of an attribute. |
int |
getAttributeCount() |
Gets a count of the number of attributes. |
Enumeration |
getAttributeNames() |
Gets the names of the attributes in the set. |
AttributeSet |
getResolveParent() |
Gets the resolving parent. |
int |
hashCode() |
Returns a hashcode for this set of attributes. |
boolean |
isDefined |
Tells whether a given attribute is defined. |
boolean |
isEmpty() |
Checks whether the set of attributes is empty. |
boolean |
isEqual |
Compares two attribute sets. |
void |
removeAttribute |
Removes an attribute from the list. |
void |
removeAttributes |
Removes a set of attributes from the list. |
void |
removeAttributes |
Removes a set of attributes from the list. |
void |
setResolveParent |
Sets the resolving parent. |
String |
toString() |
Converts the attribute set to a String. |
public static final AttributeSet EMPTY
public SimpleAttributeSet()
public SimpleAttributeSet(AttributeSet source)
source
- the set of attributespublic boolean isEmpty()
public int getAttributeCount()
getAttributeCount
in interface AttributeSet
public boolean isDefined(Object attrName)
isDefined
in interface AttributeSet
attrName
- the attribute namepublic boolean isEqual(AttributeSet attr)
isEqual
in interface AttributeSet
attr
- the second attribute setpublic AttributeSet copyAttributes()
copyAttributes
in interface AttributeSet
public Enumeration<?> getAttributeNames()
getAttributeNames
in interface AttributeSet
Enumeration
public Object getAttribute(Object name)
getAttribute
in interface AttributeSet
name
- the attribute namepublic boolean containsAttribute(Object name, Object value)
containsAttribute
in interface AttributeSet
name
- the namevalue
- the valuepublic boolean containsAttributes(AttributeSet attributes)
containsAttributes
in interface AttributeSet
attributes
- the attribute listpublic void addAttribute(Object name, Object value)
addAttribute
in interface MutableAttributeSet
name
- the attribute namevalue
- the attribute valuepublic void addAttributes(AttributeSet attributes)
addAttributes
in interface MutableAttributeSet
attributes
- the set of attributes to addpublic void removeAttribute(Object name)
removeAttribute
in interface MutableAttributeSet
name
- the attribute namepublic void removeAttributes(Enumeration<?> names)
removeAttributes
in interface MutableAttributeSet
names
- the set of names to removepublic void removeAttributes(AttributeSet attributes)
removeAttributes
in interface MutableAttributeSet
attributes
- the set of attributes to removepublic AttributeSet getResolveParent()
getResolveParent
in interface AttributeSet
public void setResolveParent(AttributeSet parent)
setResolveParent
in interface MutableAttributeSet
parent
- the parentpublic Object clone()
public int hashCode()
public boolean equals(Object obj)
true
if the object is an equivalent set of attributes.public String toString()
© 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/SimpleAttributeSet.html