7 Java Accessibility Utilities Overview

To provide access to a Java application, an assistive technology requires more than the Java Accessibility API; it also requires support for locating user interface (UI) objects that implement the Java Accessibility API, loading assistive technology support into the JVM, and tracking events. The Java Accessibility Utilities provide this assistance.

The Java Accessibility Utilities, which is contained in the package com.sun.java.accessibility.util, provide the necessary support for assistive technologies to locate and query UI objects inside a Java application running in a JVM. It also provides support for installing event listeners into these objects. These event listeners enable UI objects to learn about specific events occurring in other UI objects using the peer-to-peer approach defined by the delegation event model. This package is made up of the following major pieces:

Key Information about Java Applications

The com.sun.java.accessibility.util package contains methods for retrieving key information about Java applications running in a JVM. This support provides a list of the top-level windows of all of the Java applications; an event listener architecture to be informed when top-level windows appear (and disappear); and means for locating the window that has the input focus, locating the mouse position, and inserting events into the system event queue.

Automatic Loading of Assistive Technologies

For an assistive technology to work with a Java application, load it into the same JVM as the Java application to which it is providing access. This is done through the use of the assistive_technologies property; see Loading Assistive Technologies. This support is in the class EventQueueMonitor.

Event Support

The Java Accessibility Utilities include three classes for monitoring events in the Java Virtual Machine. The first class, AWTEventMonitor, provides a way to monitor all AWT events in all AWT components running in the JVM. This class essentially provides system-wide monitoring of AWT events, registering an individual listener for each AWT event type on each AWT component that supports that type of listener. Thus, an assistive technology can register a "Focused listener" with AWTEventMonitor, which will in turn register a "Focused listener" with each and every AWT component in each and every Java application in the JVM. Those individual listeners will funnel the events that they hear about to the assistive technology that registered the listener with AWTEventMonitor in the first place. Thus, whenever a component gains or loses focus (for example, the user presses the Tab key), the assistive technology will be notified.

The second class, SwingEventMonitor, extends AWTEventMonitor to provide additional support for monitoring the Swing events supported by the Swing components.  Since SwingEventMonitor extends AWTEventMonitor, there is no need to use both classes if you are using SwingEventMonitor in your assistive technology.

The third class, AccessibilityEventMonitor, provides support for property change events on Accessible objects.  When an assisitive technology requests notification of Accessible property change events using AccessibilityEventMonitor, the AccessibilityEventMonitor will automatically register Accessible property change listeners on all the components.  In addition, it will detect when components are added and removed from the component hierarchy and add and remove the property change listeners accordingly.  When an Accessible property change occurs in any of the components, the AccessibilityEventMonitor will notify the assistive technology.