Other Accessible Objects

Before going further, there are several simple objects in the Accessibility package used by AccessibleContext that we should discuss in more detail.

AccessibleState

Each accessible component can have one or more states associated with it. An assistive technology can query these states at any time to determine how best to deal with the component. The accessible states can only be retrieved, however, and not set. There are two classes that the Accessible package uses to handle states: AccessibleState and AccessibleStateSet.

The AccessibleState class contains an enumeration of static objects that define states that any accessible component can have. Note that a component can be in more than one state at any time. A list of the possible states that an accessible object can be in, along with a brief description of each, is shown in Table 25.3.

Table 25-3. AccessibleState Constants

State

Meaning

ACTIVE

The window, dialog, or frame is the active one

ARMED

The object, such as a button, has been pressed but not released, and the mouse cursor is still over the button

BUSY

The object is busy processing and should not be interrupted

CHECKED

The object is checked

COLLAPSED

The object, such as a node in a tree, is collapsed

EDITABLE

The object supports any form of editing

ENABLED

The object is enabled

EXPANDABLE

The object, such as a node in a tree, can report its children

EXPANDED

The object, such as a node in a tree, is expanded ...

Get Java Swing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.