com.sun.java.accessibility.util
Class AWTEventMonitor

java.lang.Object
  |
  +--com.sun.java.accessibility.util.AWTEventMonitor
Direct Known Subclasses:
SwingEventMonitor

public class AWTEventMonitor
extends java.lang.Object

The AWTEventMonitor implements a suite of listeners that are conditionally installed on every AWT component instance in the Java Virtual Machine. The events captured by these listeners are made available through a unified set of listeners supported by AWTEventMonitor. With this, all the individual events on each of the AWT component instances are funnelled into one set of listeners broken down by category (see EventID for the categories).

This class depends upon EventQueueMonitor, which provides the base level support for capturing the top-level containers as they are created.

For JDK1.1 only, the EventQueueMonitor 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.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).


Field Summary
protected static java.awt.event.ActionListener actionListener
          The current list of registered ActionListener classes.
protected static java.awt.event.AdjustmentListener adjustmentListener
          The current list of registered AdjustmentListener classes.
protected static com.sun.java.accessibility.util.AWTEventMonitor.AWTEventsListener awtListener
          The actual listener that is installed on the component instances.
protected static java.awt.event.ComponentListener componentListener
          The current list of registered ComponentListener classes.
protected static java.awt.Component componentWithFocus
          The current component with keyboard focus.
protected static java.awt.event.ContainerListener containerListener
          The current list of registered ContainerListener classes.
protected static java.awt.event.FocusListener focusListener
          The current list of registered FocusListener classes.
protected static java.awt.event.ItemListener itemListener
          The current list of registered ItemListener classes.
protected static java.awt.event.KeyListener keyListener
          The current list of registered KeyListener classes.
protected static java.awt.event.MouseListener mouseListener
          The current list of registered MouseListener classes.
protected static java.awt.event.MouseMotionListener mouseMotionListener
          The current list of registered MouseMotionListener classes.
protected static java.awt.event.TextListener textListener
          The current list of registered TextListener classes.
protected static java.awt.event.WindowListener windowListener
          The current list of registered WindowListener classes.
 
Constructor Summary
AWTEventMonitor()
           
 
Method Summary
static void addActionListener(java.awt.event.ActionListener l)
          Adds the specified listener to receive all Action events on each component instance in the Java Virtual Machine when they occur.
static void addAdjustmentListener(java.awt.event.AdjustmentListener l)
          Adds the specified listener to receive all Adjustment events on each component instance in the Java Virtual Machine when they occur.
static void addComponentListener(java.awt.event.ComponentListener l)
          Adds the specified listener to receive all Component events on each component instance in the Java Virtual Machine as they occur.
static void addContainerListener(java.awt.event.ContainerListener l)
          Adds the specified listener to receive all Container events on each component instance in the Java Virtual Machine as they occur.
static void addFocusListener(java.awt.event.FocusListener l)
          Adds the specified listener to receive all Focus events on each component instance in the Java Virtual Machine when they occur.
static void addItemListener(java.awt.event.ItemListener l)
          Adds the specified listener to receive all Item events on each component instance in the Java Virtual Machine when they occur.
static void addKeyListener(java.awt.event.KeyListener l)
          Adds the specified listener to receive all Key events on each component instance in the Java Virtual Machine when they occur.
static void addMouseListener(java.awt.event.MouseListener l)
          Adds the specified listener to receive all Mouse events on each component instance in the Java Virtual Machine when they occur.
static void addMouseMotionListener(java.awt.event.MouseMotionListener l)
          Adds the specified listener to receive all MouseMotion events on each component instance in the Java Virtual Machine when they occur.
static void addTextListener(java.awt.event.TextListener l)
          Adds the specified listener to receive all Text events on each component instance in the Java Virtual Machine when they occur.
static void addWindowListener(java.awt.event.WindowListener l)
          Adds the specified listener to receive all Window events on each component instance in the Java Virtual Machine when they occur.
static java.awt.Component getComponentWithFocus()
          Returns the component that currently has keyboard focus.
static void removeActionListener(java.awt.event.ActionListener l)
          Removes the specified listener so it no longer receives Action events when they occur.
static void removeAdjustmentListener(java.awt.event.AdjustmentListener l)
          Removes the specified listener so it no longer receives Adjustment events when they occur.
static void removeComponentListener(java.awt.event.ComponentListener l)
          Removes the specified listener so it no longer receives Component events when they occur.
static void removeContainerListener(java.awt.event.ContainerListener l)
          Removes the specified listener so it no longer receives Container events when they occur.
static void removeFocusListener(java.awt.event.FocusListener l)
          Removes the specified listener so it no longer receives Focus events when they occur.
static void removeItemListener(java.awt.event.ItemListener l)
          Removes the specified listener so it no longer receives Item events when they occur.
static void removeKeyListener(java.awt.event.KeyListener l)
          Removes the specified listener so it no longer receives Key events when they occur.
static void removeMouseListener(java.awt.event.MouseListener l)
          Removes the specified listener so it no longer receives Mouse events when they occur.
static void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
          Removes the specified listener so it no longer receives Motion events when they occur.
static void removeTextListener(java.awt.event.TextListener l)
          Removes the specified listener so it no longer receives Text events when they occur.
static void removeWindowListener(java.awt.event.WindowListener l)
          Removes the specified listener so it no longer receives Window events when they occur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

componentWithFocus

protected static java.awt.Component componentWithFocus
The current component with keyboard focus.
See Also:
getComponentWithFocus()

componentListener

protected static java.awt.event.ComponentListener componentListener
The current list of registered ComponentListener classes.
See Also:
addComponentListener(java.awt.event.ComponentListener), removeComponentListener(java.awt.event.ComponentListener)

containerListener

protected static java.awt.event.ContainerListener containerListener
The current list of registered ContainerListener classes.
See Also:
addContainerListener(java.awt.event.ContainerListener), removeContainerListener(java.awt.event.ContainerListener)

focusListener

protected static java.awt.event.FocusListener focusListener
The current list of registered FocusListener classes.
See Also:
addFocusListener(java.awt.event.FocusListener), removeFocusListener(java.awt.event.FocusListener)

keyListener

protected static java.awt.event.KeyListener keyListener
The current list of registered KeyListener classes.
See Also:
addKeyListener(java.awt.event.KeyListener), removeKeyListener(java.awt.event.KeyListener)

mouseListener

protected static java.awt.event.MouseListener mouseListener
The current list of registered MouseListener classes.
See Also:
addMouseListener(java.awt.event.MouseListener), removeMouseListener(java.awt.event.MouseListener)

mouseMotionListener

protected static java.awt.event.MouseMotionListener mouseMotionListener
The current list of registered MouseMotionListener classes.
See Also:
addMouseMotionListener(java.awt.event.MouseMotionListener), removeMouseMotionListener(java.awt.event.MouseMotionListener)

windowListener

protected static java.awt.event.WindowListener windowListener
The current list of registered WindowListener classes.
See Also:
addWindowListener(java.awt.event.WindowListener), removeWindowListener(java.awt.event.WindowListener)

actionListener

protected static java.awt.event.ActionListener actionListener
The current list of registered ActionListener classes.
See Also:
addActionListener(java.awt.event.ActionListener), removeActionListener(java.awt.event.ActionListener)

adjustmentListener

protected static java.awt.event.AdjustmentListener adjustmentListener
The current list of registered AdjustmentListener classes.
See Also:
addAdjustmentListener(java.awt.event.AdjustmentListener), removeAdjustmentListener(java.awt.event.AdjustmentListener)

itemListener

protected static java.awt.event.ItemListener itemListener
The current list of registered ItemListener classes.
See Also:
addItemListener(java.awt.event.ItemListener), removeItemListener(java.awt.event.ItemListener)

textListener

protected static java.awt.event.TextListener textListener
The current list of registered TextListener classes.
See Also:
addTextListener(java.awt.event.TextListener), removeTextListener(java.awt.event.TextListener)

awtListener

protected static com.sun.java.accessibility.util.AWTEventMonitor.AWTEventsListener awtListener
The actual listener that is installed on the component instances. This listener calls the other registered listeners when an event occurs. By doing things this way, the actual number of listeners installed on a component instance is drastically reduced.
See Also:
componentListener, containerListener, focusListener, keyListener, mouseListener, mouseMotionListener, windowListener, actionListener, adjustmentListener, itemListener, textListener
Constructor Detail

AWTEventMonitor

public AWTEventMonitor()
Method Detail

getComponentWithFocus

public static java.awt.Component getComponentWithFocus()
Returns the component that currently has keyboard focus. The return value can be null.

addComponentListener

public static void addComponentListener(java.awt.event.ComponentListener l)
Adds the specified listener to receive all Component events on each component instance in the Java Virtual Machine as they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeComponentListener(java.awt.event.ComponentListener)

removeComponentListener

public static void removeComponentListener(java.awt.event.ComponentListener l)
Removes the specified listener so it no longer receives Component events when they occur.
Parameters:
l - the listener to remove
See Also:
addComponentListener(java.awt.event.ComponentListener)

addContainerListener

public static void addContainerListener(java.awt.event.ContainerListener l)
Adds the specified listener to receive all Container events on each component instance in the Java Virtual Machine as they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeContainerListener(java.awt.event.ContainerListener)

removeContainerListener

public static void removeContainerListener(java.awt.event.ContainerListener l)
Removes the specified listener so it no longer receives Container events when they occur.
Parameters:
l - the listener to remove
See Also:
addContainerListener(java.awt.event.ContainerListener)

addFocusListener

public static void addFocusListener(java.awt.event.FocusListener l)
Adds the specified listener to receive all Focus events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeFocusListener(java.awt.event.FocusListener)

removeFocusListener

public static void removeFocusListener(java.awt.event.FocusListener l)
Removes the specified listener so it no longer receives Focus events when they occur.
Parameters:
l - the listener to remove
See Also:
addFocusListener(java.awt.event.FocusListener)

addKeyListener

public static void addKeyListener(java.awt.event.KeyListener l)
Adds the specified listener to receive all Key events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeKeyListener(java.awt.event.KeyListener)

removeKeyListener

public static void removeKeyListener(java.awt.event.KeyListener l)
Removes the specified listener so it no longer receives Key events when they occur.
Parameters:
l - the listener to remove
See Also:
addKeyListener(java.awt.event.KeyListener)

addMouseListener

public static void addMouseListener(java.awt.event.MouseListener l)
Adds the specified listener to receive all Mouse events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeMouseListener(java.awt.event.MouseListener)

removeMouseListener

public static void removeMouseListener(java.awt.event.MouseListener l)
Removes the specified listener so it no longer receives Mouse events when they occur.
Parameters:
l - the listener to remove
See Also:
addMouseListener(java.awt.event.MouseListener)

addMouseMotionListener

public static void addMouseMotionListener(java.awt.event.MouseMotionListener l)
Adds the specified listener to receive all MouseMotion events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeMouseMotionListener(java.awt.event.MouseMotionListener)

removeMouseMotionListener

public static void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
Removes the specified listener so it no longer receives Motion events when they occur.
Parameters:
l - the listener to remove
See Also:
addMouseMotionListener(java.awt.event.MouseMotionListener)

addWindowListener

public static void addWindowListener(java.awt.event.WindowListener l)
Adds the specified listener to receive all Window events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeWindowListener(java.awt.event.WindowListener)

removeWindowListener

public static void removeWindowListener(java.awt.event.WindowListener l)
Removes the specified listener so it no longer receives Window events when they occur.
Parameters:
l - the listener to remove
See Also:
addWindowListener(java.awt.event.WindowListener)

addActionListener

public static void addActionListener(java.awt.event.ActionListener l)
Adds the specified listener to receive all Action events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeActionListener(java.awt.event.ActionListener)

removeActionListener

public static void removeActionListener(java.awt.event.ActionListener l)
Removes the specified listener so it no longer receives Action events when they occur.
Parameters:
l - the listener to remove
See Also:
addActionListener(java.awt.event.ActionListener)

addAdjustmentListener

public static void addAdjustmentListener(java.awt.event.AdjustmentListener l)
Adds the specified listener to receive all Adjustment events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeAdjustmentListener(java.awt.event.AdjustmentListener)

removeAdjustmentListener

public static void removeAdjustmentListener(java.awt.event.AdjustmentListener l)
Removes the specified listener so it no longer receives Adjustment events when they occur.
Parameters:
l - the listener to remove
See Also:
addAdjustmentListener(java.awt.event.AdjustmentListener)

addItemListener

public static void addItemListener(java.awt.event.ItemListener l)
Adds the specified listener to receive all Item events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeItemListener(java.awt.event.ItemListener)

removeItemListener

public static void removeItemListener(java.awt.event.ItemListener l)
Removes the specified listener so it no longer receives Item events when they occur.
Parameters:
l - the listener to remove
See Also:
addItemListener(java.awt.event.ItemListener)

addTextListener

public static void addTextListener(java.awt.event.TextListener l)
Adds the specified listener to receive all Text events on each component instance in the Java Virtual Machine when they occur.

Note: this listener is automatically added to all component instances created after this method is called. In addition, it is only added to component instances that support this listener type.

Parameters:
l - the listener to add
See Also:
removeTextListener(java.awt.event.TextListener)

removeTextListener

public static void removeTextListener(java.awt.event.TextListener l)
Removes the specified listener so it no longer receives Text events when they occur.
Parameters:
l - the listener to remove
See Also:
addTextListener(java.awt.event.TextListener)