# Class SwingEventMonitor

java.lang.Object
com.sun.java.accessibility.util.AWTEventMonitor
com.sun.java.accessibility.util.SwingEventMonitor

public class SwingEventMonitor extends AWTEventMonitor

`SwingEventMonitor` extends `AWTEventMonitor` by adding a suite of listeners conditionally installed on every Swing component instance in the Java Virtual Machine. The events captured by these listeners are made available through a unified set of listeners supported by `SwingEventMonitor`. With this, all the individual events on each of the AWT and Swing 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.

Because this class extends `AWTEventMonitor`, it is not necessary to use this class and `AWTEventMonitor` at the same time. If you want to monitor both AWT and Swing components, you should use just this class.

See Also:
  - `AWTEventMonitor`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final EventListenerList`
`listenerList`
The master list of all listeners registered by other classes.

## Constructor Summary

Constructors
Constructor
Description
`SwingEventMonitor()`
Constructs a `SwingEventMonitor`.

## Method Summary

Modifier and Type
Method
Description
`static void`
`addAncestorListener(AncestorListener l)`
Adds the specified listener to receive all `ANCESTOR` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addCaretListener(CaretListener l)`
Adds the specified listener to receive all `CARET` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addCellEditorListener(CellEditorListener l)`
Adds the specified listener to receive all `CELLEDITOR` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addChangeListener(ChangeListener l)`
Adds the specified listener to receive all `CHANGE` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addColumnModelListener(TableColumnModelListener l)`
Adds the specified listener to receive all `COLUMNMODEL` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addDocumentListener(DocumentListener l)`
Adds the specified listener to receive all `DOCUMENT` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addInternalFrameListener(InternalFrameListener l)`
Adds the specified listener to receive all `INTERNALFRAME` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addListDataListener(ListDataListener l)`
Adds the specified listener to receive all `LISTDATA` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addListSelectionListener(ListSelectionListener l)`
Adds the specified listener to receive all `LISTSELECTION` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addMenuListener(MenuListener l)`
Adds the specified listener to receive all `MENU` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addPopupMenuListener(PopupMenuListener l)`
Adds the specified listener to receive all `POPUPMENU` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addPropertyChangeListener(PropertyChangeListener l)`
Adds the specified listener to receive all `PROPERTYCHANGE` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addTableModelListener(TableModelListener l)`
Adds the specified listener to receive all `TABLEMODEL` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addTreeExpansionListener(TreeExpansionListener l)`
Adds the specified listener to receive all `TREEEXPANSION` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addTreeModelListener(TreeModelListener l)`
Adds the specified listener to receive all `TREEMODEL` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addTreeSelectionListener(TreeSelectionListener l)`
Adds the specified listener to receive all `TREESELECTION` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addUndoableEditListener(UndoableEditListener l)`
Adds the specified listener to receive all `UNDOABLEEDIT` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`addVetoableChangeListener(VetoableChangeListener l)`
Adds the specified listener to receive all `VETOABLECHANGE` events on each component instance in the Java Virtual Machine as they occur.
`static void`
`removeAncestorListener(AncestorListener l)`
Removes the specified listener so it no longer receives `ANCESTOR` events when they occur.
`static void`
`removeCaretListener(CaretListener l)`
Removes the specified listener so it no longer receives `CARET` events when they occur.
`static void`
`removeCellEditorListener(CellEditorListener l)`
Removes the specified listener so it no longer receives `CELLEDITOR` events when they occur.
`static void`
`removeChangeListener(ChangeListener l)`
Removes the specified listener so it no longer receives `CHANGE` events when they occur.
`static void`
`removeColumnModelListener(TableColumnModelListener l)`
Removes the specified listener so it no longer receives `COLUMNMODEL` events when they occur.
`static void`
`removeDocumentListener(DocumentListener l)`
Removes the specified listener so it no longer receives `DOCUMENT` events when they occur.
`static void`
`removeInternalFrameListener(InternalFrameListener l)`
Removes the specified listener so it no longer receives `INTERNALFRAME` events when they occur.
`static void`
`removeListDataListener(ListDataListener l)`
Removes the specified listener so it no longer receives `LISTDATA` events when they occur.
`static void`
`removeListSelectionListener(ListSelectionListener l)`
Removes the specified listener so it no longer receives `LISTSELECTION` events when they occur.
`static void`
`removeMenuListener(MenuListener l)`
Removes the specified listener so it no longer receives `MENU` events when they occur.
`static void`
`removePopupMenuListener(PopupMenuListener l)`
Removes the specified listener so it no longer receives `POPUPMENU` events when they occur.
`static void`
`removePropertyChangeListener(PropertyChangeListener l)`
Removes the specified listener so it no longer receives `PROPERTYCHANGE` events when they occur.
`static void`
`removeTableModelListener(TableModelListener l)`
Removes the specified listener so it no longer receives `TABLEMODEL` events when they occur.
`static void`
`removeTreeExpansionListener(TreeExpansionListener l)`
Removes the specified listener so it no longer receives `TREEEXPANSION` events when they occur.
`static void`
`removeTreeModelListener(TreeModelListener l)`
Removes the specified listener so it no longer receives `TREEMODEL` events when they occur.
`static void`
`removeTreeSelectionListener(TreeSelectionListener l)`
Removes the specified listener so it no longer receives `TREESELECTION` events when they occur.
`static void`
`removeUndoableEditListener(UndoableEditListener l)`
Removes the specified listener so it no longer receives `UNDOABLEEDIT` events when they occur.
`static void`
`removeVetoableChangeListener(VetoableChangeListener l)`
Removes the specified listener so it no longer receives `VETOABLECHANGE` events when they occur.

### Methods declared in class AWTEventMonitor

`addActionListener, addAdjustmentListener, addComponentListener, addContainerListener, addFocusListener, addItemListener, addKeyListener, addMouseListener, addMouseMotionListener, addTextListener, addWindowListener, getComponentWithFocus, removeActionListener, removeAdjustmentListener, removeComponentListener, removeContainerListener, removeFocusListener, removeItemListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeTextListener, removeWindowListener`
Modifier and Type
Method
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.

### Methods declared in class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
Modifier and Type
Method
Description
`protected Object`
`clone()`
Creates and returns a copy of this object.
`boolean`
`equals(Object obj)`
Indicates whether some other object is "equal to" this one.
`protected void`
`finalize()`
Deprecated, for removal: This API element is subject to removal in a future version.
Finalization is deprecated and subject to removal in a future release.
`final Class<?>`
`getClass()`
Returns the runtime class of this `Object`.
`int`
`hashCode()`
Returns a hash code value for this object.
`final void`
`notify()`
Wakes up a single thread that is waiting on this object's monitor.
`final void`
`notifyAll()`
Wakes up all threads that are waiting on this object's monitor.
`String`
`toString()`
Returns a string representation of the object.
`final void`
`wait()`
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
`final void`
`wait(long timeoutMillis)`
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
`final void`
`wait(long timeoutMillis, int nanos)`
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

## Field Details

### listenerList

protected static final EventListenerList listenerList
The master list of all listeners registered by other classes. This can only be publicly modified by calling the add or remove listener methods in this class.

## Constructor Details

### SwingEventMonitor

public SwingEventMonitor()
Constructs a `SwingEventMonitor`.

## Method Details

### addAncestorListener

public static void addAncestorListener(AncestorListener l)
Adds the specified listener to receive all `ANCESTOR` 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:
  - `removeAncestorListener(AncestorListener)`

### removeAncestorListener

public static void removeAncestorListener(AncestorListener l)
Removes the specified listener so it no longer receives `ANCESTOR` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addAncestorListener(AncestorListener)`

### addCaretListener

public static void addCaretListener(CaretListener l)
Adds the specified listener to receive all `CARET` 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:
  - `removeCaretListener(CaretListener)`

### removeCaretListener

public static void removeCaretListener(CaretListener l)
Removes the specified listener so it no longer receives `CARET` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addCaretListener(CaretListener)`

### addCellEditorListener

public static void addCellEditorListener(CellEditorListener l)
Adds the specified listener to receive all `CELLEDITOR` 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:
  - `removeCellEditorListener(CellEditorListener)`

### removeCellEditorListener

public static void removeCellEditorListener(CellEditorListener l)
Removes the specified listener so it no longer receives `CELLEDITOR` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addCellEditorListener(CellEditorListener)`

### addChangeListener

public static void addChangeListener(ChangeListener l)
Adds the specified listener to receive all `CHANGE` 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:
  - `removeChangeListener(ChangeListener)`

### removeChangeListener

public static void removeChangeListener(ChangeListener l)
Removes the specified listener so it no longer receives `CHANGE` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addChangeListener(ChangeListener)`

### addColumnModelListener

public static void addColumnModelListener(TableColumnModelListener l)
Adds the specified listener to receive all `COLUMNMODEL` 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:
  - `removeColumnModelListener(TableColumnModelListener)`

### removeColumnModelListener

public static void removeColumnModelListener(TableColumnModelListener l)
Removes the specified listener so it no longer receives `COLUMNMODEL` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addColumnModelListener(TableColumnModelListener)`

### addDocumentListener

public static void addDocumentListener(DocumentListener l)
Adds the specified listener to receive all `DOCUMENT` 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:
  - `removeDocumentListener(DocumentListener)`

### removeDocumentListener

public static void removeDocumentListener(DocumentListener l)
Removes the specified listener so it no longer receives `DOCUMENT` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addDocumentListener(DocumentListener)`

### addListDataListener

public static void addListDataListener(ListDataListener l)
Adds the specified listener to receive all `LISTDATA` 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:
  - `removeListDataListener(ListDataListener)`

### removeListDataListener

public static void removeListDataListener(ListDataListener l)
Removes the specified listener so it no longer receives `LISTDATA` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addListDataListener(ListDataListener)`

### addListSelectionListener

public static void addListSelectionListener(ListSelectionListener l)
Adds the specified listener to receive all `LISTSELECTION` 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:
  - `removeListSelectionListener(ListSelectionListener)`

### removeListSelectionListener

public static void removeListSelectionListener(ListSelectionListener l)
Removes the specified listener so it no longer receives `LISTSELECTION` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addListSelectionListener(ListSelectionListener)`

### addMenuListener

public static void addMenuListener(MenuListener l)
Adds the specified listener to receive all `MENU` 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:
  - `removeMenuListener(MenuListener)`

### removeMenuListener

public static void removeMenuListener(MenuListener l)
Removes the specified listener so it no longer receives `MENU` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addMenuListener(MenuListener)`

### addPopupMenuListener

public static void addPopupMenuListener(PopupMenuListener l)
Adds the specified listener to receive all `POPUPMENU` 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:
  - `removePopupMenuListener(PopupMenuListener)`

### removePopupMenuListener

public static void removePopupMenuListener(PopupMenuListener l)
Removes the specified listener so it no longer receives `POPUPMENU` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addPopupMenuListener(PopupMenuListener)`

### addTableModelListener

public static void addTableModelListener(TableModelListener l)
Adds the specified listener to receive all `TABLEMODEL` 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:
  - `removeTableModelListener(TableModelListener)`

### removeTableModelListener

public static void removeTableModelListener(TableModelListener l)
Removes the specified listener so it no longer receives `TABLEMODEL` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addTableModelListener(TableModelListener)`

### addTreeExpansionListener

public static void addTreeExpansionListener(TreeExpansionListener l)
Adds the specified listener to receive all `TREEEXPANSION` 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:
  - `removeTreeExpansionListener(TreeExpansionListener)`

### removeTreeExpansionListener

public static void removeTreeExpansionListener(TreeExpansionListener l)
Removes the specified listener so it no longer receives `TREEEXPANSION` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addTreeExpansionListener(TreeExpansionListener)`

### addTreeModelListener

public static void addTreeModelListener(TreeModelListener l)
Adds the specified listener to receive all `TREEMODEL` 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:
  - `removeTreeModelListener(TreeModelListener)`

### removeTreeModelListener

public static void removeTreeModelListener(TreeModelListener l)
Removes the specified listener so it no longer receives `TREEMODEL` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addTreeModelListener(TreeModelListener)`

### addTreeSelectionListener

public static void addTreeSelectionListener(TreeSelectionListener l)
Adds the specified listener to receive all `TREESELECTION` 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:
  - `removeTreeSelectionListener(TreeSelectionListener)`

### removeTreeSelectionListener

public static void removeTreeSelectionListener(TreeSelectionListener l)
Removes the specified listener so it no longer receives `TREESELECTION` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addTreeSelectionListener(TreeSelectionListener)`

### addUndoableEditListener

public static void addUndoableEditListener(UndoableEditListener l)
Adds the specified listener to receive all `UNDOABLEEDIT` 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:
  - `removeUndoableEditListener(UndoableEditListener)`

### removeUndoableEditListener

public static void removeUndoableEditListener(UndoableEditListener l)
Removes the specified listener so it no longer receives `UNDOABLEEDIT` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addUndoableEditListener(UndoableEditListener)`

### addInternalFrameListener

public static void addInternalFrameListener(InternalFrameListener l)
Adds the specified listener to receive all `INTERNALFRAME` 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:
  - `removeInternalFrameListener(InternalFrameListener)`

### removeInternalFrameListener

public static void removeInternalFrameListener(InternalFrameListener l)
Removes the specified listener so it no longer receives `INTERNALFRAME` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addInternalFrameListener(InternalFrameListener)`

### addPropertyChangeListener

public static void addPropertyChangeListener(PropertyChangeListener l)
Adds the specified listener to receive all `PROPERTYCHANGE` 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:
  - `removePropertyChangeListener(PropertyChangeListener)`

### removePropertyChangeListener

public static void removePropertyChangeListener(PropertyChangeListener l)
Removes the specified listener so it no longer receives `PROPERTYCHANGE` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addPropertyChangeListener(PropertyChangeListener)`

### addVetoableChangeListener

public static void addVetoableChangeListener(VetoableChangeListener l)
Adds the specified listener to receive all `VETOABLECHANGE` 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:
  - `removeVetoableChangeListener(VetoableChangeListener)`

### removeVetoableChangeListener

public static void removeVetoableChangeListener(VetoableChangeListener l)
Removes the specified listener so it no longer receives `VETOABLECHANGE` events when they occur.

Parameters:
  `l` - the listener to remove
See Also:
  - `addVetoableChangeListener(VetoableChangeListener)`