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

[Home] [What are they?] [Overview of API Features] [API Reference]
[FAQ] [Examples] [Changes] [Compatibility table] [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.

Snap shot of Java Monitor in action.

Preparing to Run JavaMonitor with JDK1.1:

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

The JavaMonitor class is in the examples/JavaMonitor directory included with this release of the Java Accessibility Utilities (click here to view the source). The compiled classes of JavaMonitor are also included in the jaccess-examples.jar file includes with this release.  Before you can run JavaMonitor, 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=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 JavaTM 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 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 JavaMonitor with JDK1.2:

    To run JavaMonitor 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 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:

  • 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=JavaMonitor
    After you follow these instructions, you should be ready to run JavaMonitor.

    Running JavaMonitor with JDK1.1 or JDK1.2:

    By following the instructions above, JavaMonitor 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 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.

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

    When one of the events is selected in the list, you can choose to bring up an AccessibilityPanel from the Panels menu. This will display additional accessible information about 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.  You can also bring up a popup menu of AccessibilityPanels by right-clicking over the events list.

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


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

    Sun MicroSystems