The Six Types of Accessibility

Accessible components can export six types of assistive functionalities: actions, text properties, component properties, selections, hypertext, and bounded-range value properties. Most of these functions are already present in the Swing components, so if you stick closely to Swing, you probably won’t need to implement these interfaces in your components. In an effort to explain how one might implement these interfaces, we have provided a simple example showing how to add AccessibleAction support to an AWT-based component.

The AccessibleAction Interface

The AccessibleAction interface outlines the methods that an accessible object or component must have to export its actions. The interface consists of only three methods. The idea is that an assistive technology can determine the correct action by obtaining the total number of actions that the component exports, then reviewing each of their descriptions to resolve the correct one. Once this has occurred, the doAccessibleAction() method can be called with the correct index to invoke the required method.

Properties

The properties listed in Table 25.5 must be readable through the AccessibleAction interface. The accessibleActionCount stores the number of accesible actions that the component implements. The indexed property accessibleActionDescription provides a string describing the action associated with the given index. The action with index is the component’s default action.

Table 25-5. AccessibleAction ...

Get Java Swing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.