- java.lang.Object
-
- javax.swing.text.StyleContext.SmallAttributeSet
-
- All Implemented Interfaces:
- AttributeSet
- Enclosing class:
- StyleContext
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
Constructors Constructor and Description StyleContext.SmallAttributeSet(AttributeSet attrs)
StyleContext.SmallAttributeSet(Object[] attributes)
-
Method Summary
Methods Modifier and Type Method and Description Object
clone()
Clones a set of attributes.boolean
containsAttribute(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
-
-
-
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
-
hashCode
public int hashCode()
Returns a hashcode for this set of attributes.- Overrides:
hashCode
in classObject
- Returns:
- a hashcode value for this set of attributes.
- See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object obj)
Compares this object to the specifed object. The result istrue
if the object is an equivalent set of attributes.- Overrides:
equals
in classObject
- Parameters:
obj
- the object to compare with.- Returns:
true
if the objects are equal;false
otherwise.- See Also:
Object.hashCode()
,HashMap
-
clone
public Object 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:
getAttributeCount
in interfaceAttributeSet
- 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
in interfaceAttributeSet
- 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
in interfaceAttributeSet
- 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
in interfaceAttributeSet
- Returns:
- the copy
- See Also:
AttributeSet.copyAttributes()
-
getAttribute
public Object getAttribute(Object key)
Gets the value of an attribute.- Specified by:
getAttribute
in interfaceAttributeSet
- 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
in interfaceAttributeSet
- 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
in interfaceAttributeSet
- Parameters:
name
- the attribute namevalue
- the attribute value- Returns:
- true if the name/value is defined
- See Also:
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)
-
containsAttributes
public boolean containsAttributes(AttributeSet attrs)
Checks whether the attribute set contains all of the given attributes.- Specified by:
containsAttributes
in interfaceAttributeSet
- 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
in interfaceAttributeSet
- Returns:
- the attributes from the parent
- See Also:
AttributeSet.getResolveParent()
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/text/stylecontext.smallattributeset.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.