com.sun.java.accessibility.util
Class EventQueueMonitor

java.lang.Object
  |
  +--com.sun.java.accessibility.util.EventQueueMonitor

public class EventQueueMonitor
extends java.lang.Object
implements java.awt.event.AWTEventListener

The EventQueueMonitor is an EventQueue subclass that provides key core functionality for Assistive Technologies (and other system-level technologies that need some of the same things that Assistive Technology needs).

For JDK1.1, this class is meant to be automatically loaded by the Toolkit when it starts up. In order for this to happen, this class needs to be in the CLASSPATH environment variable and the following line needs to be in the awt.properties file:

 AWT.EventQueueClass=com.sun.java.accessibility.util.EventQueueMonitor
 

For JDK1.1, this class also looks for the AWT.assistive_technologies property in the awt.properties file. This is a comma-separated list of classes that represent assistive technologies that should run in the same Java Virtual Machine as the application. If this property exists, this class will load each class in the list and create a single instance of it in the current thread.

This class is commonly used with one or two other classes, AWTEventMonitor and SwingEventMonitor, that track all events generated by AWT obects and Swing objects respectively.

For JDK1.2, EventQueueMonitor merely needs to be in the CLASSPATH. The best way for this to happen is to place the jaccess.jar file in the standard extensions directory (e.g., $JDKHOME/jre/lib/ext). In addition, the specification of the assistive technologies should no longer be in awt.properties for JDK1.2. Instead, the assistive technologies should be specified using the 'assistive_technologies' property in $JDKHOME/jre/lib/accessibility.properties.

See Also:
AWTEventMonitor, SwingEventMonitor

Constructor Summary
EventQueueMonitor()
          Create a new EventQueueMonitor instance.
 
Method Summary
static void addGUIInitializedListener(GUIInitializedListener l)
          Adds the specified listener to be notified when the GUI subsystem is initialized.
static void addTopLevelWindowListener(TopLevelWindowListener l)
          Adds the specified listener to be notified when a top level window is created or destroyed.
 void eventDispatched(java.awt.AWTEvent theEvent)
          Handle eventPosted events as a result of registering a listener on the EventQueue in initialize().
static javax.accessibility.Accessible getAccessibleAt(java.awt.Point p)
          Obtain the Accessible object at the given point on the Screen.
static java.awt.Point getCurrentMousePosition()
          Return the last recorded position of the mouse in screen coordinates.
static java.awt.Window[] getTopLevelWindows()
          Return the list of top level Windows in use in the Java Virtual Machine.
static java.awt.Window getTopLevelWindowWithFocus()
          Return the top level Window that currently has keyboard focus.
static boolean isGUIInitialized()
          Says whether the GUI subsystem has been initialized or not.
static void maybeInitialize()
          Tell the EventQueueMonitor to start listening for events if this is JDK1.2 or higher.
static void removeGUIInitializedListener(GUIInitializedListener l)
          Removed the specified listener to be notified when the GUI subsystem is initialized.
static void removeTopLevelWindowListener(TopLevelWindowListener l)
          Removed the specified listener to be notified when a top level window is created or destroyed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventQueueMonitor

public EventQueueMonitor()
Create a new EventQueueMonitor instance. Normally, this will be called only by the AWT Toolkit during initialization time. Assistive technologies should not create instances of EventQueueMonitor by themselves. Instead, they should either refer to it directly via the static methods in this class (e.g., EventQueueMonitor.getCurrentMousePosition) or obtain the instance by asking the Toolkit (e.g., Toolkit.getSystemEventQueue).
Method Detail

maybeInitialize

public static void maybeInitialize()
Tell the EventQueueMonitor to start listening for events if this is JDK1.2 or higher. If the JDK is 1.1, then this class is the EventQueue and is already listening for events in the postEvent method.

eventDispatched

public void eventDispatched(java.awt.AWTEvent theEvent)
Handle eventPosted events as a result of registering a listener on the EventQueue in initialize(). This is for JDK1.2 support. If this is JDK1.1, then this is the EventQueue and events will be delivered to postEvent.
Specified by:
eventDispatched in interface java.awt.event.AWTEventListener

getAccessibleAt

public static javax.accessibility.Accessible getAccessibleAt(java.awt.Point p)
Obtain the Accessible object at the given point on the Screen. The return value may be null if an Accessible object cannot be found at the particular point.

isGUIInitialized

public static boolean isGUIInitialized()
Says whether the GUI subsystem has been initialized or not. If this returns true, the assistive technology can freely create GUI component instances. If the return value is false, the assistive technology should register a GUIInitializedListener and wait to create GUI component instances until the listener is called.
See Also:
addGUIInitializedListener(com.sun.java.accessibility.util.GUIInitializedListener)

addGUIInitializedListener

public static void addGUIInitializedListener(GUIInitializedListener l)
Adds the specified listener to be notified when the GUI subsystem is initialized. Assistive technologies should get the results of isGUIInitialized before calling this method. is created or destroyed.
Parameters:
l - the listener to add
See Also:
isGUIInitialized(), removeTopLevelWindowListener(com.sun.java.accessibility.util.TopLevelWindowListener)

removeGUIInitializedListener

public static void removeGUIInitializedListener(GUIInitializedListener l)
Removed the specified listener to be notified when the GUI subsystem is initialized.
Parameters:
l - the listener to remove
See Also:
addGUIInitializedListener(com.sun.java.accessibility.util.GUIInitializedListener)

addTopLevelWindowListener

public static void addTopLevelWindowListener(TopLevelWindowListener l)
Adds the specified listener to be notified when a top level window is created or destroyed.
Parameters:
l - the listener to add
See Also:
removeTopLevelWindowListener(com.sun.java.accessibility.util.TopLevelWindowListener)

removeTopLevelWindowListener

public static void removeTopLevelWindowListener(TopLevelWindowListener l)
Removed the specified listener to be notified when a top level window is created or destroyed.
Parameters:
l - the listener to remove
See Also:
addTopLevelWindowListener(com.sun.java.accessibility.util.TopLevelWindowListener)

getCurrentMousePosition

public static java.awt.Point getCurrentMousePosition()
Return the last recorded position of the mouse in screen coordinates.
Returns:
the last recorded position of the mouse in screen coordinates

getTopLevelWindows

public static java.awt.Window[] getTopLevelWindows()
Return the list of top level Windows in use in the Java Virtual Machine.
Returns:
an array of top level Windows in use in the Java Virtual Machine

getTopLevelWindowWithFocus

public static java.awt.Window getTopLevelWindowWithFocus()
Return the top level Window that currently has keyboard focus.
Returns:
the top level Window that currently has keyboard focus