public class

SimpleAttributeSet

extends Object
implements Serializable Cloneable MutableAttributeSet
java.lang.Object
   ↳ javax.swing.text.SimpleAttributeSet

Class Overview

A straightforward implementation of MutableAttributeSet using a hash table.

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.

Summary

Fields
public static final AttributeSet EMPTY An empty attribute set.
[Expand]
Inherited Fields
From interface javax.swing.text.AttributeSet
Public Constructors
SimpleAttributeSet()
Creates a new attribute set.
SimpleAttributeSet(AttributeSet source)
Creates a new attribute set based on a supplied set of attributes.
Public Methods
void addAttribute(Object name, Object value)
Adds an attribute to the list.
void addAttributes(AttributeSet attributes)
Adds a set of attributes to the list.
Object clone()
Clones a set of attributes.
boolean containsAttribute(Object name, Object value)
Checks whether the attribute list contains a specified attribute name/value pair.
boolean containsAttributes(AttributeSet attributes)
Checks whether the attribute list contains all the specified name/value pairs.
AttributeSet copyAttributes()
Makes a copy of the attributes.
boolean equals(Object obj)
Compares this object to the specified object.
Object getAttribute(Object name)
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(Object attrName)
Tells whether a given attribute is defined.
boolean isEmpty()
Checks whether the set of attributes is empty.
boolean isEqual(AttributeSet attr)
Compares two attribute sets.
void removeAttribute(Object name)
Removes an attribute from the list.
void removeAttributes(AttributeSet attributes)
Removes a set of attributes from the list.
void removeAttributes(Enumeration<?> names)
Removes a set of attributes from the list.
void setResolveParent(AttributeSet parent)
Sets the resolving parent.
String toString()
Converts the attribute set to a String.
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.swing.text.AttributeSet
From interface javax.swing.text.MutableAttributeSet

Fields

public static final AttributeSet EMPTY

An empty attribute set.

Public Constructors

public SimpleAttributeSet ()

Creates a new attribute set.

public SimpleAttributeSet (AttributeSet source)

Creates a new attribute set based on a supplied set of attributes.

Parameters
source the set of attributes

Public Methods

public void addAttribute (Object name, Object value)

Adds an attribute to the list.

Parameters
name the attribute name
value the attribute value

public void addAttributes (AttributeSet attributes)

Adds a set of attributes to the list.

Parameters
attributes the set of attributes to add

public Object clone ()

Clones a set of attributes.

Returns
  • the new set of attributes

public boolean containsAttribute (Object name, Object value)

Checks whether the attribute list contains a specified attribute name/value pair.

Parameters
name the name
value the value
Returns
  • true if the name/value pair is in the list

public boolean containsAttributes (AttributeSet attributes)

Checks whether the attribute list contains all the specified name/value pairs.

Parameters
attributes the attribute list
Returns
  • true if the list contains all the name/value pairs

public AttributeSet copyAttributes ()

Makes a copy of the attributes.

Returns
  • the copy

public boolean equals (Object obj)

Compares this object to the specified object. The result is true if the object is an equivalent set of attributes.

Parameters
obj the object to compare this attribute set with
Returns
  • true if the objects are equal; false otherwise

public Object getAttribute (Object name)

Gets the value of an attribute.

Parameters
name the attribute name
Returns
  • the value

public int getAttributeCount ()

Gets a count of the number of attributes.

Returns
  • the count

public Enumeration<?> getAttributeNames ()

Gets the names of the attributes in the set.

Returns
  • the names as an Enumeration

public AttributeSet getResolveParent ()

Gets the resolving parent. This is the set of attributes to resolve through if an attribute isn't defined locally. This is null if there are no other sets of attributes to resolve through.

Returns
  • the parent

public int hashCode ()

Returns a hashcode for this set of attributes.

Returns
  • a hashcode value for this set of attributes.

public boolean isDefined (Object attrName)

Tells whether a given attribute is defined.

Parameters
attrName the attribute name
Returns
  • true if the attribute is defined

public boolean isEmpty ()

Checks whether the set of attributes is empty.

Returns
  • true if the set is empty else false

public boolean isEqual (AttributeSet attr)

Compares two attribute sets.

Parameters
attr the second attribute set
Returns
  • true if the sets are equal, false otherwise

public void removeAttribute (Object name)

Removes an attribute from the list.

Parameters
name the attribute name

public void removeAttributes (AttributeSet attributes)

Removes a set of attributes from the list.

Parameters
attributes the set of attributes to remove

public void removeAttributes (Enumeration<?> names)

Removes a set of attributes from the list.

Parameters
names the set of names to remove

public void setResolveParent (AttributeSet parent)

Sets the resolving parent.

Parameters
parent the parent

public String toString ()

Converts the attribute set to a String.

Returns
  • the string