May 15, 2021 SWING
The event listener represents the interface responsible for handling the event. J ava provides a variety of event listener classes, but we'll discuss those that are used more frequently. E ach method of an event listener has an argument as an object that is a sub-class of the EventObject class. For example, the mouse event listener's method accepts an instance of MouseEvent, where MouseEvent is derived from EventObject.
It is a tag interface that must be extended by each listener interface. This class is defined in the java.util package.
Here's a statement from the java.util.EventListener interface:
public interface EventListener
Below is a list of common event listeners.
Sr. No. | Control and description |
---|---|
1 |
ActionListener
This interface is used to receive action events. |
2 |
ComponentListener
This interface is used to receive component events. |
3 |
ItemListener
This interface is used to receive project events. |
4 |
KeyListener
This interface is used to receive keystroke events. |
5 |
MouseListener
This interface is used to receive mouse events. |
6 |
WindowListener
This interface is used to receive window events. |
7 |
AdjustmentListener
This interface is used to receive adjustment events. |
8 |
ContainerListener
This interface is used to receive container events. |
9 |
MouseMotionListener
This interface is used to receive mouse movement events. |
10 |
FocusListener
This interface is used to receive focus events. |