AWT Event Listeners - AWT (Abstract Window Toolkit)

What is the use of AWT Event Listeners?

AWT Event listener is used for representing the interfaces which is responsible for handling events. Java provides several Event listener classes but we will discuss only those which are frequently used. Every method of an event listener method will have a single argument as an object which is subclass of EventObject class. For example, mouse event listener methods accept instance of MouseEvent, which is derived from EventObject.

EventListner interface

It is a marker interface which every listener interface extends and this class is defined in java.util package.

Class declaration

Below is the declaration for java.util.EventListener interface:

AWT Event Listener Interfaces:

Below is the list of commonly used event listeners.

Sr. No.

Control & Description

1

ActionListener

This interface receives the action events.

2

ComponentListener

This interface receives the component events.

3

ItemListener

This interface receives the item events.

4

KeyListener

This interface receives the key events.

5

MouseListener

This interface receives the mouse events.

6

TextListener

This interface receives the text events.

7

WindowListener

This interface receives the window events.

8

AdjustmentListener

This interface receives the adjusmtent events.

9

ContainerListener

This interface receives the container events.

10

MouseMotionListener

This interface receives the mouse motion events.

11

FocusListener

This interface receives the focus events.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

AWT (Abstract Window Toolkit) Topics