@Exported 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.
Modifier and Type | Field and Description |
---|---|
protected static ActionListener |
actionListener
Deprecated.
This field is unused.
|
protected static AdjustmentListener |
adjustmentListener
Deprecated.
This field is unused.
|
protected static com.sun.java.accessibility.util.AWTEventMonitor.AWTEventsListener |
awtListener
Deprecated.
This field is unused.
|
protected static ComponentListener |
componentListener
Deprecated.
This field is unused.
|
protected static Component |
componentWithFocus
Deprecated.
This field is unused; to get the component with focus use the
getComponentWithFocus method.
|
protected static ContainerListener |
containerListener
Deprecated.
This field is unused.
|
protected static FocusListener |
focusListener
Deprecated.
This field is unused.
|
protected static ItemListener |
itemListener
Deprecated.
This field is unused.
|
protected static KeyListener |
keyListener
Deprecated.
This field is unused.
|
protected static MouseListener |
mouseListener
Deprecated.
This field is unused.
|
protected static MouseMotionListener |
mouseMotionListener
Deprecated.
This field is unused.
|
protected static TextListener |
textListener
Deprecated.
This field is unused.
|
protected static WindowListener |
windowListener
Deprecated.
This field is unused.
|
Constructor and Description |
---|
AWTEventMonitor() |
Modifier and Type | Method and Description |
---|---|
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
static Component |
getComponentWithFocus()
Returns the component that currently has keyboard focus.
|
static void |
removeActionListener(ActionListener l)
Removes the specified listener so it no longer receives
ACTION events when they occur. |
static void |
removeAdjustmentListener(AdjustmentListener l)
Removes the specified listener so it no longer receives
ADJUSTMENT events when they occur. |
static void |
removeComponentListener(ComponentListener l)
Removes the specified listener so it no longer receives
COMPONENT events when they occur. |
static void |
removeContainerListener(ContainerListener l)
Removes the specified listener so it no longer receives
CONTAINER events when they occur. |
static void |
removeFocusListener(FocusListener l)
Removes the specified listener so it no longer receives
FOCUS
events when they occur. |
static void |
removeItemListener(ItemListener l)
Removes the specified listener so it no longer receives
ITEM
events when they occur. |
static void |
removeKeyListener(KeyListener l)
Removes the specified listener so it no longer receives
KEY
events when they occur. |
static void |
removeMouseListener(MouseListener l)
Removes the specified listener so it no longer receives
MOUSE events when they occur. |
static void |
removeMouseMotionListener(MouseMotionListener l)
Removes the specified listener so it no longer receives
MOTION events when they occur. |
static void |
removeTextListener(TextListener l)
Removes the specified listener so it no longer receives
TEXT
events when they occur. |
static void |
removeWindowListener(WindowListener l)
Removes the specified listener so it no longer receives
WINDOW events when they occur. |
@Deprecated protected static Component componentWithFocus
getComponentWithFocus()
@Deprecated protected static ComponentListener componentListener
@Deprecated protected static ContainerListener containerListener
@Deprecated protected static FocusListener focusListener
@Deprecated protected static KeyListener keyListener
@Deprecated protected static MouseListener mouseListener
@Deprecated protected static MouseMotionListener mouseMotionListener
@Deprecated protected static WindowListener windowListener
@Deprecated protected static ActionListener actionListener
@Deprecated protected static AdjustmentListener adjustmentListener
@Deprecated protected static ItemListener itemListener
@Deprecated protected static TextListener textListener
@Deprecated protected static com.sun.java.accessibility.util.AWTEventMonitor.AWTEventsListener awtListener
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 addremoveComponentListener(java.awt.event.ComponentListener)
public static void removeComponentListener(ComponentListener l)
COMPONENT
events when they occur.l
- the listener to removeaddComponentListener(java.awt.event.ComponentListener)
public 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 addremoveContainerListener(java.awt.event.ContainerListener)
public static void removeContainerListener(ContainerListener l)
CONTAINER
events when they occur.l
- the listener to removeaddContainerListener(java.awt.event.ContainerListener)
public 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 addremoveFocusListener(java.awt.event.FocusListener)
public static void removeFocusListener(FocusListener l)
FOCUS
events when they occur.l
- the listener to removeaddFocusListener(java.awt.event.FocusListener)
public 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 addremoveKeyListener(java.awt.event.KeyListener)
public static void removeKeyListener(KeyListener l)
KEY
events when they occur.l
- the listener to removeaddKeyListener(java.awt.event.KeyListener)
public 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 addremoveMouseListener(java.awt.event.MouseListener)
public static void removeMouseListener(MouseListener l)
MOUSE
events when they occur.l
- the listener to removeaddMouseListener(java.awt.event.MouseListener)
public 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 addremoveMouseMotionListener(java.awt.event.MouseMotionListener)
public static void removeMouseMotionListener(MouseMotionListener l)
MOTION
events when they occur.l
- the listener to removeaddMouseMotionListener(java.awt.event.MouseMotionListener)
public 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 addremoveWindowListener(java.awt.event.WindowListener)
public static void removeWindowListener(WindowListener l)
WINDOW
events when they occur.l
- the listener to removeaddWindowListener(java.awt.event.WindowListener)
public 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 addremoveActionListener(java.awt.event.ActionListener)
public static void removeActionListener(ActionListener l)
ACTION
events when they occur.l
- the listener to removeaddActionListener(java.awt.event.ActionListener)
public 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 addremoveAdjustmentListener(java.awt.event.AdjustmentListener)
public static void removeAdjustmentListener(AdjustmentListener l)
ADJUSTMENT
events when they occur.l
- the listener to removeaddAdjustmentListener(java.awt.event.AdjustmentListener)
public 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 addremoveItemListener(java.awt.event.ItemListener)
public static void removeItemListener(ItemListener l)
ITEM
events when they occur.l
- the listener to removeaddItemListener(java.awt.event.ItemListener)
public 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 addremoveTextListener(java.awt.event.TextListener)
public static void removeTextListener(TextListener l)
TEXT
events when they occur.l
- the listener to removeaddTextListener(java.awt.event.TextListener)
Copyright © 2002, 2016, Oracle and/or its affiliates. All rights reserved.