This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text
class SimpleAttributeSet

java.lang.Object extended by javax.swing.text.SimpleAttributeSet
All Implemented Interfaces:
Serializable, Cloneable, MutableAttributeSet

Most common way to construct:

SimpleAttributeSet attribute = new SimpleAttributeSet();

Based on 249 examples


public class SimpleAttributeSet
extends Object
implements MutableAttributeSet, Serializable, Cloneable

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 {@link java.beans.XMLEncoder}.


Field Summary
static AttributeSet EMPTY
          An empty attribute set.
 
Constructor Summary

          Creates a new attribute set.

          Creates a new attribute set based on a supplied set of attributes.
 
Method Summary
 void
addAttribute(Object name, Object value)

          Adds an attribute to the list.
 void

          Adds a set of attributes to the list.
 Object

          Clones a set of attributes.
 boolean

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

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

          Makes a copy of the attributes.
 boolean

          Compares this object to the specified object.
 Object

          Gets the value of an attribute.
 int

          Gets a count of the number of attributes.
 Enumeration

          Gets the names of the attributes in the set.
 AttributeSet

          Gets the resolving parent.
 int

          Returns a hashcode for this set of attributes.
 boolean
isDefined(Object attrName)

          Tells whether a given attribute is defined.
 boolean

          Checks whether the set of attributes is empty.
 boolean

          Compares two attribute sets.
 void

          Removes an attribute from the list.
 void

          Removes a set of attributes from the list.
 void

          Removes a set of attributes from the list.
 void

          Sets the resolving parent.
 String

          Converts the attribute set to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final AttributeSet EMPTY
An empty attribute set.
Constructor Detail

SimpleAttributeSet

public SimpleAttributeSet()
Creates a new attribute set.


SimpleAttributeSet

public SimpleAttributeSet(AttributeSet source)
Creates a new attribute set based on a supplied set of attributes.

Parameters:
source - the set of attributes
Method Detail

addAttribute

public void addAttribute(Object name,
                         Object value)
Adds an attribute to the list.

Parameters:
name - the attribute name
value - the attribute value

addAttributes

public void addAttributes(AttributeSet attributes)
Adds a set of attributes to the list.

Parameters:
attributes - the set of attributes to add

clone

public Object clone()
Clones a set of attributes.

Overrides:
clone in class Object
Returns:
the new set of attributes

containsAttribute

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

containsAttributes

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

copyAttributes

public AttributeSet copyAttributes()
Makes a copy of the attributes.

Returns:
the copy

equals

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.

Overrides:
equals in class Object
Parameters:
obj - the object to compare this attribute set with
Returns:
true if the objects are equal; false otherwise

getAttribute

public Object getAttribute(Object name)
Gets the value of an attribute.

Parameters:
name - the attribute name
Returns:
the value

getAttributeCount

public int getAttributeCount()
Gets a count of the number of attributes.

Returns:
the count

getAttributeNames

public Enumeration getAttributeNames()
Gets the names of the attributes in the set.

Returns:
the names as an Enumeration

getResolveParent

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

hashCode

public int hashCode()
Returns a hashcode for this set of attributes.

Overrides:
hashCode in class Object
Returns:
a hashcode value for this set of attributes.

isDefined

public boolean isDefined(Object attrName)
Tells whether a given attribute is defined.

Parameters:
attrName - the attribute name
Returns:
true if the attribute is defined

isEmpty

public boolean isEmpty()
Checks whether the set of attributes is empty.

Returns:
true if the set is empty else false

isEqual

public boolean isEqual(AttributeSet attr)
Compares two attribute sets.

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

removeAttribute

public void removeAttribute(Object name)
Removes an attribute from the list.

Parameters:
name - the attribute name

removeAttributes

public void removeAttributes(AttributeSet attributes)
Removes a set of attributes from the list.

Parameters:
attributes - the set of attributes to remove

removeAttributes

public void removeAttributes(Enumeration names)
Removes a set of attributes from the list.

Parameters:
names - the set of names to remove

setResolveParent

public void setResolveParent(AttributeSet parent)
Sets the resolving parent.

Parameters:
parent - the parent

toString

public String toString()
Converts the attribute set to a String.

Overrides:
toString in class Object
Returns:
the string


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.