Class SimpleAttributeSet
- All Implemented Interfaces:
-
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
.
Nested Class Summary
Nested classes/interfaces declared in interface javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
Field Summary
Modifier and Type | Field | Description |
---|---|---|
static final AttributeSet |
EMPTY |
An empty attribute set. |
Fields declared in interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
Constructor Summary
Constructor | Description |
---|---|
SimpleAttributeSet() |
Creates a new attribute set. |
SimpleAttributeSet |
Creates a new attribute set based on a supplied set of attributes. |
Method Summary
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. |
Field Details
EMPTY
public static final AttributeSet EMPTY
Constructor Details
SimpleAttributeSet
public SimpleAttributeSet()
SimpleAttributeSet
public SimpleAttributeSet(AttributeSet source)
- Parameters:
-
source
- the set of attributes
Method Details
isEmpty
public boolean isEmpty()
- Returns:
- true if the set is empty else false
getAttributeCount
public int getAttributeCount()
- Specified by:
-
getAttributeCount
in interfaceAttributeSet
- Returns:
- the count
isDefined
public boolean isDefined(Object attrName)
- Specified by:
-
isDefined
in interfaceAttributeSet
- Parameters:
-
attrName
- the attribute name - Returns:
- true if the attribute is defined
isEqual
public boolean isEqual(AttributeSet attr)
- Specified by:
-
isEqual
in interfaceAttributeSet
- Parameters:
-
attr
- the second attribute set - Returns:
- true if the sets are equal, false otherwise
copyAttributes
public AttributeSet copyAttributes()
- Specified by:
-
copyAttributes
in interfaceAttributeSet
- Returns:
- the copy
getAttributeNames
public Enumeration<?> getAttributeNames()
- Specified by:
-
getAttributeNames
in interfaceAttributeSet
- Returns:
- the names as an
Enumeration
getAttribute
public Object getAttribute(Object name)
- Specified by:
-
getAttribute
in interfaceAttributeSet
- Parameters:
-
name
- the attribute name - Returns:
- the value
containsAttribute
public boolean containsAttribute(Object name, Object value)
- Specified by:
-
containsAttribute
in interfaceAttributeSet
- Parameters:
-
name
- the name -
value
- the value - Returns:
- true if the name/value pair is in the list
containsAttributes
public boolean containsAttributes(AttributeSet attributes)
- Specified by:
-
containsAttributes
in interfaceAttributeSet
- Parameters:
-
attributes
- the attribute list - Returns:
- true if the list contains all the name/value pairs
addAttribute
public void addAttribute(Object name, Object value)
- Specified by:
-
addAttribute
in interfaceMutableAttributeSet
- Parameters:
-
name
- the attribute name -
value
- the attribute value
addAttributes
public void addAttributes(AttributeSet attributes)
- Specified by:
-
addAttributes
in interfaceMutableAttributeSet
- Parameters:
-
attributes
- the set of attributes to add
removeAttribute
public void removeAttribute(Object name)
- Specified by:
-
removeAttribute
in interfaceMutableAttributeSet
- Parameters:
-
name
- the attribute name
removeAttributes
public void removeAttributes(Enumeration<?> names)
- Specified by:
-
removeAttributes
in interfaceMutableAttributeSet
- Parameters:
-
names
- the set of names to remove
removeAttributes
public void removeAttributes(AttributeSet attributes)
- Specified by:
-
removeAttributes
in interfaceMutableAttributeSet
- Parameters:
-
attributes
- the set of attributes to remove
getResolveParent
public AttributeSet getResolveParent()
- Specified by:
-
getResolveParent
in interfaceAttributeSet
- Returns:
- the parent
setResolveParent
public void setResolveParent(AttributeSet parent)
- Specified by:
-
setResolveParent
in interfaceMutableAttributeSet
- Parameters:
-
parent
- the parent
clone
public Object clone()
hashCode
public int hashCode()
equals
public boolean equals(Object obj)
true
if the object is an equivalent set of attributes.toString
public String toString()
© 1993, 2021, 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/17/docs/api/java.desktop/javax/swing/text/SimpleAttributeSet.html