AccessibleStateSet (Java Platform SE 8 ) (original) (raw)
- javax.accessibility.AccessibleStateSet
public class AccessibleStateSet
extends Object
Class AccessibleStateSet determines a component's state set. The state set of a component is a set of AccessibleState objects and descriptions. E.G., The current overall state of the object, such as whether it is enabled, has focus, etc.
See Also:
AccessibleState
Field Summary
Fields
Modifier and Type Field Description protected Vector<AccessibleState> states Each entry in the Vector represents an AccessibleState. Constructor Summary
Constructors
Constructor Description AccessibleStateSet() Creates a new empty state set. AccessibleStateSet(AccessibleState[] states) Creates a new state with the initial set of states contained in the array of states passed in. Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method Description boolean add(AccessibleState state) Adds a new state to the current state set if it is not already present. void addAll(AccessibleState[] states) Adds all of the states to the existing state set. void clear() Removes all the states from the current state set. boolean contains(AccessibleState state) Checks if the current state is in the state set. boolean remove(AccessibleState state) Removes a state from the current state set. AccessibleState[] toArray() Returns the current state set as an array of AccessibleState String toString() Creates a localized String representing all the states in the set using the default locale. * ### Methods inherited from class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone--), [equals](../../java/lang/Object.html#equals-java.lang.Object-), [finalize](../../java/lang/Object.html#finalize--), [getClass](../../java/lang/Object.html#getClass--), [hashCode](../../java/lang/Object.html#hashCode--), [notify](../../java/lang/Object.html#notify--), [notifyAll](../../java/lang/Object.html#notifyAll--), [wait](../../java/lang/Object.html#wait--), [wait](../../java/lang/Object.html#wait-long-), [wait](../../java/lang/Object.html#wait-long-int-)`
Field Detail
* #### states protected [Vector](../../java/util/Vector.html "class in java.util")<[AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility")> states Each entry in the Vector represents an AccessibleState. See Also: [add(javax.accessibility.AccessibleState)](../../javax/accessibility/AccessibleStateSet.html#add-javax.accessibility.AccessibleState-), [addAll(javax.accessibility.AccessibleState\[\])](../../javax/accessibility/AccessibleStateSet.html#addAll-javax.accessibility.AccessibleState:A-), [remove(javax.accessibility.AccessibleState)](../../javax/accessibility/AccessibleStateSet.html#remove-javax.accessibility.AccessibleState-), [contains(javax.accessibility.AccessibleState)](../../javax/accessibility/AccessibleStateSet.html#contains-javax.accessibility.AccessibleState-), [toArray()](../../javax/accessibility/AccessibleStateSet.html#toArray--), [clear()](../../javax/accessibility/AccessibleStateSet.html#clear--)
Constructor Detail
* #### AccessibleStateSet public AccessibleStateSet() Creates a new empty state set. * #### AccessibleStateSet public AccessibleStateSet([AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility")[] states) Creates a new state with the initial set of states contained in the array of states passed in. Duplicate entries are ignored. Parameters: `states` \- an array of AccessibleState describing the state set.
Method Detail
* #### add public boolean add([AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility") state) Adds a new state to the current state set if it is not already present. If the state is already in the state set, the state set is unchanged and the return value is false. Otherwise, the state is added to the state set and the return value is true. Parameters: `state` \- the state to add to the state set Returns: true if state is added to the state set; false if the state set is unchanged * #### addAll public void addAll([AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility")[] states) Adds all of the states to the existing state set. Duplicate entries are ignored. Parameters: `states` \- AccessibleState array describing the state set. * #### remove public boolean remove([AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility") state) Removes a state from the current state set. If the state is not in the set, the state set will be unchanged and the return value will be false. If the state is in the state set, it will be removed from the set and the return value will be true. Parameters: `state` \- the state to remove from the state set Returns: true if the state is in the state set; false if the state set will be unchanged * #### clear public void clear() Removes all the states from the current state set. * #### contains public boolean contains([AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility") state) Checks if the current state is in the state set. Parameters: `state` \- the state Returns: true if the state is in the state set; otherwise false * #### toArray public [AccessibleState](../../javax/accessibility/AccessibleState.html "class in javax.accessibility")[] toArray() Returns the current state set as an array of AccessibleState Returns: AccessibleState array containing the current state. * #### toString public [String](../../java/lang/String.html "class in java.lang") toString() Creates a localized String representing all the states in the set using the default locale. Overrides: `[toString](../../java/lang/Object.html#toString--)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Returns: comma separated localized String See Also: [AccessibleBundle.toDisplayString(java.lang.String, java.util.Locale)](../../javax/accessibility/AccessibleBundle.html#toDisplayString-java.lang.String-java.util.Locale-)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.