java.lang.Object
javax.swing.text.StyleContext.SmallAttributeSet
- All Implemented Interfaces:
AttributeSet
- Enclosing class:
- StyleContext
This class holds a small number of attributes in an array.
The storage format is key, value, key, value, etc. The size
of the set is the length of the array divided by two. By
default, this is the class that will be used to store attributes
when held in the compact sharable form.
-
Nested Class Summary
Nested classes/interfaces declared in interface javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute -
Field Summary
Fields declared in interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute -
Constructor Summary
ConstructorsConstructorDescriptionSmallAttributeSet(Object[] attributes) Constructs a SmallAttributeSet.SmallAttributeSet(AttributeSet attrs) Constructs a SmallAttributeSet. -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones a set of attributes.booleancontainsAttribute(Object name, Object value) Checks whether a given attribute name/value is defined.booleancontainsAttributes(AttributeSet attrs) Checks whether the attribute set contains all of the given attributes.Copies a set of attributes.booleanCompares this object to the specified object.getAttribute(Object key) Gets the value of an attribute.intGets the number of attributes that are defined.Enumeration<?>Gets the names of all attributes.If not overriden, the resolving parent defaults to the parent element.inthashCode()Returns a hashcode for this set of attributes.booleanChecks whether a given attribute is defined.booleanisEqual(AttributeSet attr) Checks whether two attribute sets are equal.toString()Returns a string showing the key/value pairs.
-
Constructor Details
-
SmallAttributeSet
Constructs a SmallAttributeSet.- Parameters:
attributes- the attributes
-
SmallAttributeSet
Constructs a SmallAttributeSet.- Parameters:
attrs- the attributes
-
-
Method Details
-
toString
Returns a string showing the key/value pairs. -
hashCode
public int hashCode()Returns a hashcode for this set of attributes. -
equals
Compares this object to the specified object. The result istrueif the object is an equivalent set of attributes. -
clone
Clones a set of attributes. Since the set is immutable, a clone is basically the same set. -
getAttributeCount
public int getAttributeCount()Gets the number of attributes that are defined.- Specified by:
getAttributeCountin interfaceAttributeSet- Returns:
- the number of attributes
- See Also:
-
isDefined
Checks whether a given attribute is defined.- Specified by:
isDefinedin interfaceAttributeSet- Parameters:
key- the attribute key- Returns:
- true if the attribute is defined
- See Also:
-
isEqual
Checks whether two attribute sets are equal.- Specified by:
isEqualin interfaceAttributeSet- Parameters:
attr- the attribute set to check against- Returns:
- true if the same
- See Also:
-
copyAttributes
Copies a set of attributes.- Specified by:
copyAttributesin interfaceAttributeSet- Returns:
- the copy
- See Also:
-
getAttribute
Gets the value of an attribute.- Specified by:
getAttributein interfaceAttributeSet- Parameters:
key- the attribute name- Returns:
- the attribute value
- See Also:
-
getAttributeNames
Gets the names of all attributes.- Specified by:
getAttributeNamesin interfaceAttributeSet- Returns:
- the attribute names
- See Also:
-
containsAttribute
Checks whether a given attribute name/value is defined.- Specified by:
containsAttributein interfaceAttributeSet- Parameters:
name- the attribute namevalue- the attribute value- Returns:
- true if the name/value is defined
- See Also:
-
containsAttributes
Checks whether the attribute set contains all of the given attributes.- Specified by:
containsAttributesin interfaceAttributeSet- Parameters:
attrs- the attributes to check- Returns:
- true if the element contains all the attributes
- See Also:
-
getResolveParent
If not overriden, the resolving parent defaults to the parent element.- Specified by:
getResolveParentin interfaceAttributeSet- Returns:
- the attributes from the parent
- See Also:
-