1 of 7

Adanced Java Programming

Event Handling

Smt.M.Jeevana Sujitha

Assistant Professor

Department of Computer Science and Engineering

SRKR Engineering College, Bhimavaram, A.P. - 534204

2 of 7

OBJECTIVES

The Objective of this lecture is

  • To learn about Event Handling in AWT.

3 of 7

Event Handling

  • Event: Action that can be performed on the component is called an event.
  • Event describes the change in state of source.
  • Events are generated as result of user interaction with the graphical user interface components.
  • For example, clicking on a button, moving the mouse, entering a character through keyboard are the activities that causes an event to happen.

4 of 7

Event Handling

  • Event Handling: Event Handling is the mechanism that controls the event and decides what should happen if an event occurs.
  • This mechanism have the code which is

known as event handler that is executed when an event occurs.

  • Java Uses the Event Delegation Model to handle the events. This model defines the standard mechanism to generate and handle the events.

5 of 7

Event Handling

  • The Event Delegation Model has the following two key participants.
  • Source: The source is an object on which event occurs.
  • It is responsible for providing information of the occurred event to its handler.
  • Listener: It is also handler.

known as event

for generating

  • Listener is responsible response to an event.

6 of 7

Event Handling

Steps involved in Event Handling:

  • If the clicks the button then the event is generated.
  • Now the object of concerned event class is created automatically.
  • Event object is forwarded to the method of registered listener interface.
  • The method is now get executed.

7 of 7

THANK YOU