Class AWTEventMonitor

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

public class AWTEventMonitor extends 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 funneled 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.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an AWTEventMonitor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Adds the specified listener to receive all ACTION events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all ADJUSTMENT events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all COMPONENT events on each component instance in the Java Virtual Machine as they occur.
    static void
    Adds the specified listener to receive all CONTAINER events on each component instance in the Java Virtual Machine as they occur.
    static void
    Adds the specified listener to receive all FOCUS events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all ITEM events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all KEY events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all MOUSE events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all mouse MOTION events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all TEXT events on each component instance in the Java Virtual Machine when they occur.
    static void
    Adds the specified listener to receive all WINDOW events on each component instance in the Java Virtual Machine when they occur.
    static Component
    Returns the component that currently has keyboard focus.
    static void
    Removes the specified listener so it no longer receives ACTION events when they occur.
    static void
    Removes the specified listener so it no longer receives ADJUSTMENT events when they occur.
    static void
    Removes the specified listener so it no longer receives COMPONENT events when they occur.
    static void
    Removes the specified listener so it no longer receives CONTAINER events when they occur.
    static void
    Removes the specified listener so it no longer receives FOCUS events when they occur.
    static void
    Removes the specified listener so it no longer receives ITEM events when they occur.
    static void
    Removes the specified listener so it no longer receives KEY events when they occur.
    static void
    Removes the specified listener so it no longer receives MOUSE events when they occur.
    static void
    Removes the specified listener so it no longer receives MOTION events when they occur.
    static void
    Removes the specified listener so it no longer receives TEXT events when they occur.
    static void
    Removes the specified listener so it no longer receives WINDOW events when they occur.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • AWTEventMonitor

      public AWTEventMonitor()
      Constructs an AWTEventMonitor.
  • Method Details

    • getComponentWithFocus

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

      public static void addComponentListener(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

      public static void removeComponentListener(ComponentListener l)
      Removes the specified listener so it no longer receives COMPONENT events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addContainerListener

      public static void addContainerListener(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

      public static void removeContainerListener(ContainerListener l)
      Removes the specified listener so it no longer receives CONTAINER events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addFocusListener

      public static void addFocusListener(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

      public static void removeFocusListener(FocusListener l)
      Removes the specified listener so it no longer receives FOCUS events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addKeyListener

      public static void addKeyListener(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

      public static void removeKeyListener(KeyListener l)
      Removes the specified listener so it no longer receives KEY events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addMouseListener

      public static void addMouseListener(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

      public static void removeMouseListener(MouseListener l)
      Removes the specified listener so it no longer receives MOUSE events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addMouseMotionListener

      public static void addMouseMotionListener(MouseMotionListener l)
      Adds the specified listener to receive all mouse MOTION 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

      public static void removeMouseMotionListener(MouseMotionListener l)
      Removes the specified listener so it no longer receives MOTION events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addWindowListener

      public static void addWindowListener(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

      public static void removeWindowListener(WindowListener l)
      Removes the specified listener so it no longer receives WINDOW events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addActionListener

      public static void addActionListener(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

      public static void removeActionListener(ActionListener l)
      Removes the specified listener so it no longer receives ACTION events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addAdjustmentListener

      public static void addAdjustmentListener(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

      public static void removeAdjustmentListener(AdjustmentListener l)
      Removes the specified listener so it no longer receives ADJUSTMENT events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addItemListener

      public static void addItemListener(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

      public static void removeItemListener(ItemListener l)
      Removes the specified listener so it no longer receives ITEM events when they occur.
      Parameters:
      l - the listener to remove
      See Also:
    • addTextListener

      public static void addTextListener(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

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