SwingEventMonitorpublic 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 | Description | 
|---|---|
| AWTEventMonitor() | Constructs an  AWTEventMonitor. | 
| Modifier and Type | Method | Description | 
|---|---|---|
| static void | addActionListener | Adds the specified listener to receive all  ACTIONevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addAdjustmentListener | Adds the specified listener to receive all  ADJUSTMENTevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addComponentListener | Adds the specified listener to receive all  COMPONENTevents on each component instance in the Java Virtual Machine as they occur. | 
| static void | addContainerListener | Adds the specified listener to receive all  CONTAINERevents on each component instance in the Java Virtual Machine as they occur. | 
| static void | addFocusListener | Adds the specified listener to receive all  FOCUSevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addItemListener | Adds the specified listener to receive all  ITEMevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addKeyListener | Adds the specified listener to receive all  KEYevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addMouseListener | Adds the specified listener to receive all  MOUSEevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addMouseMotionListener | Adds the specified listener to receive all mouse  MOTIONevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addTextListener | Adds the specified listener to receive all  TEXTevents on each component instance in the Java Virtual Machine when they occur. | 
| static void | addWindowListener | Adds the specified listener to receive all  WINDOWevents on each component instance in the Java Virtual Machine when they occur. | 
| static Component | getComponentWithFocus() | Returns the component that currently has keyboard focus. | 
| static void | removeActionListener | Removes the specified listener so it no longer receives  ACTIONevents when they occur. | 
| static void | removeAdjustmentListener | Removes the specified listener so it no longer receives  ADJUSTMENTevents when they occur. | 
| static void | removeComponentListener | Removes the specified listener so it no longer receives  COMPONENTevents when they occur. | 
| static void | removeContainerListener | Removes the specified listener so it no longer receives  CONTAINERevents when they occur. | 
| static void | removeFocusListener | Removes the specified listener so it no longer receives  FOCUSevents when they occur. | 
| static void | removeItemListener | Removes the specified listener so it no longer receives  ITEMevents when they occur. | 
| static void | removeKeyListener | Removes the specified listener so it no longer receives  KEYevents when they occur. | 
| static void | removeMouseListener | Removes the specified listener so it no longer receives  MOUSEevents when they occur. | 
| static void | removeMouseMotionListener | Removes the specified listener so it no longer receives  MOTIONevents when they occur. | 
| static void | removeTextListener | Removes the specified listener so it no longer receives  TEXTevents when they occur. | 
| static void | removeWindowListener | Removes the specified listener so it no longer receives  WINDOWevents when they occur. | 
public AWTEventMonitor()
AWTEventMonitor.public static Component getComponentWithFocus()
public static void addComponentListener(ComponentListener l)
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.
l - the listener to addpublic static void removeComponentListener(ComponentListener l)
COMPONENT events when they occur.l - the listener to removepublic static void addContainerListener(ContainerListener l)
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.
l - the listener to addpublic static void removeContainerListener(ContainerListener l)
CONTAINER events when they occur.l - the listener to removepublic static void addFocusListener(FocusListener l)
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.
l - the listener to addpublic static void removeFocusListener(FocusListener l)
FOCUS events when they occur.l - the listener to removepublic static void addKeyListener(KeyListener l)
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.
l - the listener to addpublic static void removeKeyListener(KeyListener l)
KEY events when they occur.l - the listener to removepublic static void addMouseListener(MouseListener l)
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.
l - the listener to addpublic static void removeMouseListener(MouseListener l)
MOUSE events when they occur.l - the listener to removepublic static void addMouseMotionListener(MouseMotionListener l)
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.
l - the listener to addpublic static void removeMouseMotionListener(MouseMotionListener l)
MOTION events when they occur.l - the listener to removepublic static void addWindowListener(WindowListener l)
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.
l - the listener to addpublic static void removeWindowListener(WindowListener l)
WINDOW events when they occur.l - the listener to removepublic static void addActionListener(ActionListener l)
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.
l - the listener to addpublic static void removeActionListener(ActionListener l)
ACTION events when they occur.l - the listener to removepublic static void addAdjustmentListener(AdjustmentListener l)
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.
l - the listener to addpublic static void removeAdjustmentListener(AdjustmentListener l)
ADJUSTMENT events when they occur.l - the listener to removepublic static void addItemListener(ItemListener l)
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.
l - the listener to addpublic static void removeItemListener(ItemListener l)
ITEM events when they occur.l - the listener to removepublic static void addTextListener(TextListener l)
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.
l - the listener to addpublic static void removeTextListener(TextListener l)
TEXT events when they occur.l - the listener to remove
    © 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/21/docs/api/jdk.accessibility/com/sun/java/accessibility/util/AWTEventMonitor.html