StyleContext.SmallAttributeSet (Java Platform SE 6) (original) (raw)
javax.swing.text
Class StyleContext.SmallAttributeSet
java.lang.Object
javax.swing.text.StyleContext.SmallAttributeSet
All Implemented Interfaces:
Enclosing class:
public class StyleContext.SmallAttributeSet
extends Object
implements AttributeSet
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 inherited from interface javax.swing.text.AttributeSet |
---|
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
Field Summary |
---|
Fields inherited from interface javax.swing.text.AttributeSet |
---|
NameAttribute, ResolveAttribute |
Constructor Summary |
---|
StyleContext.SmallAttributeSet(AttributeSet attrs) |
StyleContext.SmallAttributeSet(Object[] attributes) |
Method Summary | |
---|---|
Object | clone() Clones a set of attributes. |
boolean | [containsAttribute](../../../javax/swing/text/StyleContext.SmallAttributeSet.html#containsAttribute%28java.lang.Object, java.lang.Object%29)(Object name,Object value) Checks whether a given attribute name/value is defined. |
boolean | containsAttributes(AttributeSet attrs) Checks whether the attribute set contains all of the given attributes. |
AttributeSet | copyAttributes() Copies a set of attributes. |
boolean | equals(Object obj) Compares this object to the specifed object. |
Object | getAttribute(Object key) Gets the value of an attribute. |
int | getAttributeCount() Gets the number of attributes that are defined. |
Enumeration<?> | getAttributeNames() Gets the names of all attributes. |
AttributeSet | getResolveParent() If not overriden, the resolving parent defaults to the parent element. |
int | hashCode() Returns a hashcode for this set of attributes. |
boolean | isDefined(Object key) Checks whether a given attribute is defined. |
boolean | isEqual(AttributeSet attr) Checks whether two attribute sets are equal. |
String | toString() Returns a string showing the key/value pairs |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, [wait](../../../java/lang/Object.html#wait%28long, int%29) |
Constructor Detail |
---|
StyleContext.SmallAttributeSet
public StyleContext.SmallAttributeSet(Object[] attributes)
StyleContext.SmallAttributeSet
public StyleContext.SmallAttributeSet(AttributeSet attrs)
Method Detail |
---|
toString
public String toString()
Returns a string showing the key/value pairs
Overrides:
[toString](../../../java/lang/Object.html#toString%28%29)
in class [Object](../../../java/lang/Object.html "class in java.lang")
Returns:
a string representation of the object.
hashCode
public int hashCode()
Returns a hashcode for this set of attributes.
Overrides:
[hashCode](../../../java/lang/Object.html#hashCode%28%29)
in class [Object](../../../java/lang/Object.html "class in java.lang")
Returns:
a hashcode value for this set of attributes.
See Also:
Object.equals(java.lang.Object), Hashtable
equals
public boolean equals(Object obj)
Compares this object to the specifed object. The result is true
if the object is an equivalent set of attributes.
Overrides:
[equals](../../../java/lang/Object.html#equals%28java.lang.Object%29)
in class [Object](../../../java/lang/Object.html "class in java.lang")
Parameters:
obj
- the object to compare with.
Returns:
true
if the objects are equal; false
otherwise.
See Also:
clone
public Object clone()
Clones a set of attributes. Since the set is immutable, a clone is basically the same set.
Overrides:
[clone](../../../java/lang/Object.html#clone%28%29)
in class [Object](../../../java/lang/Object.html "class in java.lang")
Returns:
the set of attributes
See Also:
getAttributeCount
public int getAttributeCount()
Gets the number of attributes that are defined.
Specified by:
[getAttributeCount](../../../javax/swing/text/AttributeSet.html#getAttributeCount%28%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Returns:
the number of attributes
See Also:
AttributeSet.getAttributeCount()
isDefined
public boolean isDefined(Object key)
Checks whether a given attribute is defined.
Specified by:
[isDefined](../../../javax/swing/text/AttributeSet.html#isDefined%28java.lang.Object%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Parameters:
key
- the attribute key
Returns:
true if the attribute is defined
See Also:
AttributeSet.isDefined(java.lang.Object)
isEqual
public boolean isEqual(AttributeSet attr)
Checks whether two attribute sets are equal.
Specified by:
[isEqual](../../../javax/swing/text/AttributeSet.html#isEqual%28javax.swing.text.AttributeSet%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Parameters:
attr
- the attribute set to check against
Returns:
true if the same
See Also:
AttributeSet.isEqual(javax.swing.text.AttributeSet)
copyAttributes
public AttributeSet copyAttributes()
Copies a set of attributes.
Specified by:
[copyAttributes](../../../javax/swing/text/AttributeSet.html#copyAttributes%28%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Returns:
the copy
See Also:
getAttribute
public Object getAttribute(Object key)
Gets the value of an attribute.
Specified by:
[getAttribute](../../../javax/swing/text/AttributeSet.html#getAttribute%28java.lang.Object%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Parameters:
key
- the attribute name
Returns:
the attribute value
See Also:
AttributeSet.getAttribute(java.lang.Object)
getAttributeNames
public Enumeration<?> getAttributeNames()
Gets the names of all attributes.
Specified by:
[getAttributeNames](../../../javax/swing/text/AttributeSet.html#getAttributeNames%28%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Returns:
the attribute names
See Also:
AttributeSet.getAttributeNames()
containsAttribute
public boolean containsAttribute(Object name, Object value)
Checks whether a given attribute name/value is defined.
Specified by:
[containsAttribute](../../../javax/swing/text/AttributeSet.html#containsAttribute%28java.lang.Object, java.lang.Object%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Parameters:
name
- the attribute name
value
- the attribute value
Returns:
true if the name/value is defined
See Also:
[AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)](../../../javax/swing/text/AttributeSet.html#containsAttribute%28java.lang.Object, java.lang.Object%29)
containsAttributes
public boolean containsAttributes(AttributeSet attrs)
Checks whether the attribute set contains all of the given attributes.
Specified by:
[containsAttributes](../../../javax/swing/text/AttributeSet.html#containsAttributes%28javax.swing.text.AttributeSet%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Parameters:
attrs
- the attributes to check
Returns:
true if the element contains all the attributes
See Also:
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)
getResolveParent
public AttributeSet getResolveParent()
If not overriden, the resolving parent defaults to the parent element.
Specified by:
[getResolveParent](../../../javax/swing/text/AttributeSet.html#getResolveParent%28%29)
in interface [AttributeSet](../../../javax/swing/text/AttributeSet.html "interface in javax.swing.text")
Returns:
the attributes from the parent
See Also:
AttributeSet.getResolveParent()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
Scripting on this page tracks web page traffic, but does not change the content in any way.