The Source for Java - java.sun.com
JAVA ACCESSIBILITY
AccessibilityMonitor Example
Version 1.1

[Home] [What are they?] [Overview of API Features] [API Reference]
[FAQ] [Examples] [Changes] [Compatibility table] [JFC Home Page]

The AccessibilityMonitor example allows you to obtain information about the objects being displayed on the screen by a particular JavaTM Virtual Machine, and includes options to obtain additional accessibility features provided by the Java Foundation Classes

Snap shot of Accessibility Monitor in action.

Preparing to Run AccessibilityMonitor with JDK1.1:

To run AccessibilityMonitor with JDK1.1, you need to have obtained and installed JFC 1.1 with Swing 1.13 and JDK1.1.6.  In addition, you need to be using the Java Accessibility Utilities Version 1.1.

The AccessibilityMonitor class is in the examples/AccessibilityMonitor directory included with this release of the Java Accessibility Utilities (click here to view the source). Before you can run it, you need to set up your environment appropriately by following these instructions:

  • Add the jaccess.jar and jaccess-examples.jar files to your CLASSPATH environment variable.
  • Modify your $JDKHOME/lib/awt.properties file to include the following lines:
  • AWT.EventQueueClass=com.sun.java.accessibility.util.EventQueueMonitor
    AWT.assistive_technologies=AccessibilityMonitor
    After you follow these instructions, you should be ready to run AccessibilityMonitor.  If you did not set up your CLASSPATH correctly you might get one of the following errors when running a JavaTM application:
    Failed loading com.sun.java.accessibility.util.EventQueueMonitor: 
    java.lang.ClassNotFoundException: 
    com.sun.java.accessibility.util.EventQueueMonitor
    Error trying to newInstance AccessibilityMonitor java.lang.ClassNotFoundException: 
    AccessibilityMonitor
    The first error means the jaccess.jar file is not in your CLASSPATH, and the second means the jaccess-examples.jar file is not in your CLASSPATH.

    Preparing to Run AccessibilityMonitor with JDK1.2:

    To run AccessibilityMonitor with JDK1.2 you need to have obtained and installed JDK1.2.  In addition, you need to be using the Java Accessibility Utilities Version 1.2.

    The AccessibilityMonitor class is in the examples/AccessibilityMonitor directory included with this release of the Java Accessibility Utilities (click here to view the source). Before you can run it, you need to set up your environment appropriately by following these instructions:

  • Copy jaccess.jar and jaccess-examples.jar to the $JDKHOME/jre/lib/ext directory under your JDK1.2 installation.
  • Modify (create one if it doesn't exist) your $JDKHOME/jre/lib/accessibility.properties file to include the following line:
  • assistive_technologies=AccessibilityMonitor
    After you follow these instructions, you should be ready to run AccessibilityMonitor.

    Running AccessibilityMonitor with both JDK1.1 and JDK1.2:

    By following the instructions above, AccessibilityMonitor will automatically be started any time you start a Java application. For example, you can run the SwingSet demo that comes as part of the demonstration applications for Swing.

    Using AccessibilityMonitor:

    AccessibilityMonitor contains at the top a check box, which, when checked, causes AccessibilityMonitor to monitor all PropertyChange events on all of the non-transient Accessible user interface objects in the Java Virtual Machine. Transient user interface objects are those which are only created in response to a query of their parent (or a more distant ancestor), but which don't otherwise have a life of their own in the Java Virtual Machine (for example cells of a table or list, which aren't actual AWT components except for the brief moment in time during which they are drawn to the screen). Transient objects contain the AccessibleState.TRANSIENT state in their AccessibleStateSet.  AccessibilityMonitor registers an interest in the events by using calls to the AccessibilityEventMonitor class from the Java Accessibility Utilities package whenever you click on the "Accessibility PropertyChange Events" checkbox.

    The bulk of the window contains a table listing the PropertyChange events that is updated periodically as the events occur. The first column of the table contains the Accessible Name of the object which generated the event (these will often be blank as many objects [generally container objects] don't have Accessible names). The second column contains the name of the property which changed (generating the event). The third and fourth columns contain string representations of the old and new values (respectively) of that property.

    Picture of the panel that allows you to manipulate the object's AccessibleActions Picture of the panel that allows you to manipulate the object's AccessibleSelection Picture of the panel that allows you to manipulate the object's AccessibleHypertext

    Holding down the right-most mouse button on an event in either the first or second row of the table will display a popup menu that provides options for you to get additional accessible information from the object.  The first option will provide you with information similar to that provided by the Explorer example.  The second option allows you to manipulate the AccessibleActions of the object, the third option allows you to manipulate the AccessibleSelections of the object, and the fourth option allows you to manipulate the AccessibleHypertext links of the object.   If you hold down the right-most mouse button on either the third or fourth column, the same menu will appear if and only if either the value (old or new) represents an Accessible object itself (e.g. if the AccessibleChild property is the type of event, then the event represents either the birth or death of an AccessibleChild of the object which generated the event), and the panels which come up are for that old or new Accessible object. You can bring up an AccessibilityPanel without using the mouse by first selecting the table cell you are interested in, and then choosing the AccessibilityPanel from the Panels menu.


    Java Logo Copyright© 1995-97 Sun Microsystems, Inc. All Rights Reserved.
    To submit comments or suggestions about Java Accessibility, please send mail to access@sun.com.

    Sun MicroSystems