Page 412 - CITS - Computer Software Application -TT
P. 412
COMPUTER SOFTWARE APPLICATION - CITS
Java AWT Hierarchy:-
The hierarchy of Java AWT classes are given below.
Introduction to event Handling
What is an Event?
Change in the state of an object is known as event i.e. 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, selecting an item from list, scrolling the page
are the activities that causes an event to happen.
Types of Event
The events can be broadly classified into two categories:
Foreground Events - Those events which require the direct interaction of user. They are generated as
consequences of a person interacting with the graphical components in Graphical User Interface. For example,
clicking on a button, moving the mouse, entering a character through keyboard,selecting an item from list, scrolling
the page etc.
Background Events - Those events that require the interaction of end user are known as background events.
Operating system interrupts, hardware or software failure, timer expires, an operation completion are the example
of background events.
What is 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 Delegation Event Model to handle the events. This model defines the standard mechanism to generate and
handle the events. Let’s have a brief introduction to this model.
The Delegation Event Model has the following key participants namely:
Source - The source is an object on which event occurs. Source is responsible for providing information of the
occurred event to it’s handler. Java provide as with classes for source object.
399
CITS : IT&ITES - Computer Software Application - Lesson 116 - 119 CITS : IT&ITES - Computer Software Application - Lesson 116 - 119