- 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.
-
Field Summary
Fields Modifier and Type Field Description protected static ActionListeneractionListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static AdjustmentListeneradjustmentListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static ComponentListenercomponentListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static ComponentcomponentWithFocusDeprecated, for removal: This API element is subject to removal in a future version.This field is unused; to get the component with focus use the getComponentWithFocus method.protected static ContainerListenercontainerListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static FocusListenerfocusListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static ItemListeneritemListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static KeyListenerkeyListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static MouseListenermouseListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static MouseMotionListenermouseMotionListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static TextListenertextListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused.protected static WindowListenerwindowListenerDeprecated, for removal: This API element is subject to removal in a future version.This field is unused. -
Constructor Summary
Constructors Constructor Description AWTEventMonitor() -
Method Summary
Modifier and Type Method Description static voidaddActionListener(ActionListener l)Adds the specified listener to receive allACTIONevents on each component instance in the Java Virtual Machine when they occur.static voidaddAdjustmentListener(AdjustmentListener l)Adds the specified listener to receive allADJUSTMENTevents on each component instance in the Java Virtual Machine when they occur.static voidaddComponentListener(ComponentListener l)Adds the specified listener to receive allCOMPONENTevents on each component instance in the Java Virtual Machine as they occur.static voidaddContainerListener(ContainerListener l)Adds the specified listener to receive allCONTAINERevents on each component instance in the Java Virtual Machine as they occur.static voidaddFocusListener(FocusListener l)Adds the specified listener to receive allFOCUSevents on each component instance in the Java Virtual Machine when they occur.static voidaddItemListener(ItemListener l)Adds the specified listener to receive allITEMevents on each component instance in the Java Virtual Machine when they occur.static voidaddKeyListener(KeyListener l)Adds the specified listener to receive allKEYevents on each component instance in the Java Virtual Machine when they occur.static voidaddMouseListener(MouseListener l)Adds the specified listener to receive allMOUSEevents on each component instance in the Java Virtual Machine when they occur.static voidaddMouseMotionListener(MouseMotionListener l)Adds the specified listener to receive all mouseMOTIONevents on each component instance in the Java Virtual Machine when they occur.static voidaddTextListener(TextListener l)Adds the specified listener to receive allTEXTevents on each component instance in the Java Virtual Machine when they occur.static voidaddWindowListener(WindowListener l)Adds the specified listener to receive allWINDOWevents on each component instance in the Java Virtual Machine when they occur.static ComponentgetComponentWithFocus()Returns the component that currently has keyboard focus.static voidremoveActionListener(ActionListener l)Removes the specified listener so it no longer receivesACTIONevents when they occur.static voidremoveAdjustmentListener(AdjustmentListener l)Removes the specified listener so it no longer receivesADJUSTMENTevents when they occur.static voidremoveComponentListener(ComponentListener l)Removes the specified listener so it no longer receivesCOMPONENTevents when they occur.static voidremoveContainerListener(ContainerListener l)Removes the specified listener so it no longer receivesCONTAINERevents when they occur.static voidremoveFocusListener(FocusListener l)Removes the specified listener so it no longer receivesFOCUSevents when they occur.static voidremoveItemListener(ItemListener l)Removes the specified listener so it no longer receivesITEMevents when they occur.static voidremoveKeyListener(KeyListener l)Removes the specified listener so it no longer receivesKEYevents when they occur.static voidremoveMouseListener(MouseListener l)Removes the specified listener so it no longer receivesMOUSEevents when they occur.static voidremoveMouseMotionListener(MouseMotionListener l)Removes the specified listener so it no longer receivesMOTIONevents when they occur.static voidremoveTextListener(TextListener l)Removes the specified listener so it no longer receivesTEXTevents when they occur.static voidremoveWindowListener(WindowListener l)Removes the specified listener so it no longer receivesWINDOWevents when they occur.
-
Field Details
-
componentWithFocus
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused; to get the component with focus use the getComponentWithFocus method.The current component with keyboard focus.- See Also:
getComponentWithFocus()
-
componentListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered ComponentListener classes. -
containerListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered ContainerListener classes. -
focusListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered FocusListener classes. -
keyListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered KeyListener classes. -
mouseListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered MouseListener classes. -
mouseMotionListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered MouseMotionListener classes. -
windowListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered WindowListener classes. -
actionListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered ActionListener classes. -
adjustmentListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered AdjustmentListener classes. -
itemListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered ItemListener classes. -
textListener
Deprecated, for removal: This API element is subject to removal in a future version.This field is unused.The current list of registered TextListener classes.
-
-
Constructor Details
-
AWTEventMonitor
public AWTEventMonitor()
-
-
Method Details
-
getComponentWithFocus
Returns the component that currently has keyboard focus. The return value can be null.- Returns:
- the component that has keyboard focus
-
addComponentListener
Adds the specified listener to receive allCOMPONENTevents 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
Removes the specified listener so it no longer receivesCOMPONENTevents when they occur.- Parameters:
l- the listener to remove- See Also:
addComponentListener(java.awt.event.ComponentListener)
-
addContainerListener
Adds the specified listener to receive allCONTAINERevents 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
Removes the specified listener so it no longer receivesCONTAINERevents when they occur.- Parameters:
l- the listener to remove- See Also:
addContainerListener(java.awt.event.ContainerListener)
-
addFocusListener
Adds the specified listener to receive allFOCUSevents 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
Removes the specified listener so it no longer receivesFOCUSevents when they occur.- Parameters:
l- the listener to remove- See Also:
addFocusListener(java.awt.event.FocusListener)
-
addKeyListener
Adds the specified listener to receive allKEYevents 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
Removes the specified listener so it no longer receivesKEYevents when they occur.- Parameters:
l- the listener to remove- See Also:
addKeyListener(java.awt.event.KeyListener)
-
addMouseListener
Adds the specified listener to receive allMOUSEevents 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
Removes the specified listener so it no longer receivesMOUSEevents when they occur.- Parameters:
l- the listener to remove- See Also:
addMouseListener(java.awt.event.MouseListener)
-
addMouseMotionListener
Adds the specified listener to receive all mouseMOTIONevents 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
Removes the specified listener so it no longer receivesMOTIONevents when they occur.- Parameters:
l- the listener to remove- See Also:
addMouseMotionListener(java.awt.event.MouseMotionListener)
-
addWindowListener
Adds the specified listener to receive allWINDOWevents 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
Removes the specified listener so it no longer receivesWINDOWevents when they occur.- Parameters:
l- the listener to remove- See Also:
addWindowListener(java.awt.event.WindowListener)
-
addActionListener
Adds the specified listener to receive allACTIONevents 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
Removes the specified listener so it no longer receivesACTIONevents when they occur.- Parameters:
l- the listener to remove- See Also:
addActionListener(java.awt.event.ActionListener)
-
addAdjustmentListener
Adds the specified listener to receive allADJUSTMENTevents 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
Removes the specified listener so it no longer receivesADJUSTMENTevents when they occur.- Parameters:
l- the listener to remove- See Also:
addAdjustmentListener(java.awt.event.AdjustmentListener)
-
addItemListener
Adds the specified listener to receive allITEMevents 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
Removes the specified listener so it no longer receivesITEMevents when they occur.- Parameters:
l- the listener to remove- See Also:
addItemListener(java.awt.event.ItemListener)
-
addTextListener
Adds the specified listener to receive allTEXTevents 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
Removes the specified listener so it no longer receivesTEXTevents when they occur.- Parameters:
l- the listener to remove- See Also:
addTextListener(java.awt.event.TextListener)
-