- java.lang.Object
- 
- javax.swing.text.SimpleAttributeSet
 
- 
- All Implemented Interfaces:
- Serializable,- Cloneable,- AttributeSet,- MutableAttributeSet
 
 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 JavaBeans™ has been added to the java.beanspackage. Please seeXMLEncoder.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces declared in interface javax.swing.text.AttributeSetAttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static AttributeSetEMPTYAn empty attribute set.- 
Fields declared in interface javax.swing.text.AttributeSetNameAttribute, ResolveAttribute
 
- 
 - 
Constructor SummaryConstructors Constructor Description SimpleAttributeSet()Creates a new attribute set.SimpleAttributeSet(AttributeSet source)Creates a new attribute set based on a supplied set of attributes.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(Object name, Object value)Adds an attribute to the list.voidaddAttributes(AttributeSet attributes)Adds a set of attributes to the list.Objectclone()Clones a set of attributes.booleancontainsAttribute(Object name, Object value)Checks whether the attribute list contains a specified attribute name/value pair.booleancontainsAttributes(AttributeSet attributes)Checks whether the attribute list contains all the specified name/value pairs.AttributeSetcopyAttributes()Makes a copy of the attributes.booleanequals(Object obj)Compares this object to the specified object.ObjectgetAttribute(Object name)Gets the value of an attribute.intgetAttributeCount()Gets a count of the number of attributes.Enumeration<?>getAttributeNames()Gets the names of the attributes in the set.AttributeSetgetResolveParent()Gets the resolving parent.inthashCode()Returns a hashcode for this set of attributes.booleanisDefined(Object attrName)Tells whether a given attribute is defined.booleanisEmpty()Checks whether the set of attributes is empty.booleanisEqual(AttributeSet attr)Compares two attribute sets.voidremoveAttribute(Object name)Removes an attribute from the list.voidremoveAttributes(Enumeration<?> names)Removes a set of attributes from the list.voidremoveAttributes(AttributeSet attributes)Removes a set of attributes from the list.voidsetResolveParent(AttributeSet parent)Sets the resolving parent.StringtoString()Converts the attribute set to a String.
 
- 
- 
- 
Field Detail- 
EMPTYpublic static final AttributeSet EMPTY An empty attribute set.
 
- 
 - 
Constructor Detail- 
SimpleAttributeSetpublic SimpleAttributeSet() Creates a new attribute set.
 - 
SimpleAttributeSetpublic SimpleAttributeSet(AttributeSet source) Creates a new attribute set based on a supplied set of attributes.- Parameters:
- source- the set of attributes
 
 
- 
 - 
Method Detail- 
isEmptypublic boolean isEmpty() Checks whether the set of attributes is empty.- Returns:
- true if the set is empty else false
 
 - 
getAttributeCountpublic int getAttributeCount() Gets a count of the number of attributes.- Specified by:
- getAttributeCountin interface- AttributeSet
- Returns:
- the count
 
 - 
isDefinedpublic boolean isDefined(Object attrName) Tells whether a given attribute is defined.- Specified by:
- isDefinedin interface- AttributeSet
- Parameters:
- attrName- the attribute name
- Returns:
- true if the attribute is defined
 
 - 
isEqualpublic boolean isEqual(AttributeSet attr) Compares two attribute sets.- Specified by:
- isEqualin interface- AttributeSet
- Parameters:
- attr- the second attribute set
- Returns:
- true if the sets are equal, false otherwise
 
 - 
copyAttributespublic AttributeSet copyAttributes() Makes a copy of the attributes.- Specified by:
- copyAttributesin interface- AttributeSet
- Returns:
- the copy
 
 - 
getAttributeNamespublic Enumeration<?> getAttributeNames() Gets the names of the attributes in the set.- Specified by:
- getAttributeNamesin interface- AttributeSet
- Returns:
- the names as an Enumeration
 
 - 
getAttributepublic Object getAttribute(Object name) Gets the value of an attribute.- Specified by:
- getAttributein interface- AttributeSet
- Parameters:
- name- the attribute name
- Returns:
- the value
 
 - 
containsAttributepublic boolean containsAttribute(Object name, Object value) Checks whether the attribute list contains a specified attribute name/value pair.- Specified by:
- containsAttributein interface- AttributeSet
- Parameters:
- name- the name
- value- the value
- Returns:
- true if the name/value pair is in the list
 
 - 
containsAttributespublic boolean containsAttributes(AttributeSet attributes) Checks whether the attribute list contains all the specified name/value pairs.- Specified by:
- containsAttributesin interface- AttributeSet
- Parameters:
- attributes- the attribute list
- Returns:
- true if the list contains all the name/value pairs
 
 - 
addAttributepublic void addAttribute(Object name, Object value) Adds an attribute to the list.- Specified by:
- addAttributein interface- MutableAttributeSet
- Parameters:
- name- the attribute name
- value- the attribute value
 
 - 
addAttributespublic void addAttributes(AttributeSet attributes) Adds a set of attributes to the list.- Specified by:
- addAttributesin interface- MutableAttributeSet
- Parameters:
- attributes- the set of attributes to add
 
 - 
removeAttributepublic void removeAttribute(Object name) Removes an attribute from the list.- Specified by:
- removeAttributein interface- MutableAttributeSet
- Parameters:
- name- the attribute name
 
 - 
removeAttributespublic void removeAttributes(Enumeration<?> names) Removes a set of attributes from the list.- Specified by:
- removeAttributesin interface- MutableAttributeSet
- Parameters:
- names- the set of names to remove
 
 - 
removeAttributespublic void removeAttributes(AttributeSet attributes) Removes a set of attributes from the list.- Specified by:
- removeAttributesin interface- MutableAttributeSet
- Parameters:
- attributes- the set of attributes to remove
 
 - 
getResolveParentpublic 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.- Specified by:
- getResolveParentin interface- AttributeSet
- Returns:
- the parent
 
 - 
setResolveParentpublic void setResolveParent(AttributeSet parent) Sets the resolving parent.- Specified by:
- setResolveParentin interface- MutableAttributeSet
- Parameters:
- parent- the parent
 
 - 
clonepublic Object clone() Clones a set of attributes.
 - 
hashCodepublic int hashCode() Returns a hashcode for this set of attributes.- Overrides:
- hashCodein class- Object
- Returns:
- a hashcode value for this set of attributes.
- See Also:
- Object.equals(java.lang.Object),- System.identityHashCode(java.lang.Object)
 
 - 
equalspublic boolean equals(Object obj) Compares this object to the specified object. The result istrueif the object is an equivalent set of attributes.- Overrides:
- equalsin class- Object
- Parameters:
- obj- the object to compare this attribute set with
- Returns:
- trueif the objects are equal;- falseotherwise
- See Also:
- Object.hashCode(),- HashMap
 
 
- 
 
-