The Source for Java - java.sun.com
JAVA ACCESSIBILITY
JavaMonitor Example
Version 1.0
March 1998

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

The JavaMonitor 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.

To run JavaMonitor you need to have obtained and installed the JDK1.1.5 or better, and the Java Foundation Classes.

Snap shot of Java Monitor in action.

Preparing to Run JavaMonitor:

The JavaMonitor class is in the examples/JavaMonitor 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:
  • Modify your CLASSPATH environment variable so that the jaccess.jar file that comes with this kit is included in the path.
  • Modify your CLASSPATH environment variable so that the examples/JavaMonitor and examples/AccessibilityPanels directories that come with this kit are included in the path.
  • Modify your $JDKHOME/lib/awt.properties file to include the following lines (a sample awt.properties can be found here):
  • AWT.EventQueueClass=com.sun.java.accessibility.util.EventQueueMonitor
    AWT.assistive_technologies=JavaMonitor
    After you follow these instructions, you should be ready to run JavaMonitor. If you did not set up your CLASSPATH correctly you might get one of the following errors when running a Java application:
    Failed loading com.sun.java.accessibility.util.EventQueueMonitor: java.lang.ClassNotFoundException: com.sun.java.accessibility.util.EventQueueMonitor
    Error trying to newInstance JavaMonitor java.lang.ClassNotFoundException: JavaMonitor
    The first error means that the jaccess.jar file is not in your CLASSPATH, and the second that the JavaMonitor directory is not in your CLASSPATH.

    Running JavaMonitor:

    By following the instructions above, JavaMonitor will automatically be started any time you start a Java application. For example, if you run the "SwingSet" demonstration application that comes with the Java Foundation Classes, JavaMonitor will automatically start.

    Using JavaMonitor:

    JavaMonitor provides several rows of checkboxes at the top of its dialog box. These checkboxes allow you to specify the classes of user interface events that you can monitor in the Java Virtual Machine. JavaMonitor registers an interest in the events by using calls to the SwingEventMonitor class from the Java Accessibility Utilities package whenever you click one of the checkboxes.

    In the middle of the dialog box is a list of events that is updated as each event occurs. Items will be posted in this list only if you select the events you are interested in by manipulating the checkboxes at the top of the box.

    In the bottom left of the dialog box is a small list box that represents the last object to have focus. It is updated each time the focus changes and contains a small sample of the information obtained from the Java Accessibility API. NOTE: This box will not be updated unless you select for Focus events.

    In the lower right of the dialog box is a small List box that you can populate by moving the pointer over an object and pressing the F1 key. This action uses calls to EventQueueMonitor to obtain the current mouse position and obtain an accessible object from that location. It then calls a small number of methods from the Java Accessibility API to display information about the object under the pointer. NOTE: This box will not be updated unless you select for key events.

    NOTE: The JFC Menus will not show any interesting information unless you select for JMenu events.


    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