Event Classes

BCA-II yr
Internet Application Using Java
Subject Type-Minor

Event Classes and Listener Interfaces

Java provides a variety of event classes and corresponding listener interfaces. Below table demonstrates the most commonly used event classes and their associated listener interfaces:

Event Class

Listener Interface

Description

ActionEvent

ActionListener

An event that indicates that a component-defined action occurred like a button click or selecting an item from the menu-item list.

AdjustmentEvent

AdjustmentListener

The adjustment event is emitted by an Adjustable object like Scrollbar.

ComponentEvent

ComponentListener

An event that indicates that a component moved, the size changed or changed its visibility.

ContainerEvent

ContainerListener

When a component is added to a container (or) removed from it, then this event is generated by a container object.

FocusEvent

FocusListener

These are focus-related events, which include focus, focusin, focusout, and blur.

ItemEvent

ItemListener

An event that indicates whether an item was selected or not.

KeyEvent

KeyListener

An event that occurs due to a sequence of keypresses on the keyboard.

MouseEvent

MouseListener & MouseMotionListener

The events that occur due to the user interaction with the mouse (Pointing Device).

MouseWheelEvent

MouseWheelListener

An event that specifies that the mouse wheel was rotated in a component. 

TextEvent

TextListener

An event that occurs when an object's text changes.

WindowEvent

WindowListener

An event which indicates whether a window has changed its status or not.

0 comments:

Post a Comment