Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Java Event Handling : Complete Tutorial - 3 Parts

Share this post!
 Vote this!

Introduction

Applets are event-driven programs. Event handling is at the core of successful applet programming. Most events to which an applet will respond are generated by the user. There are several types of events. The most commonly handled events are those generated by the mouse, the keyboard, and various controls, such as a push button. For example, when the user clicks on the mouse, the environment generates an event that it sends to the program. The program must then figure out what the mouse click means and act accordingly.

Events are supported by the java.awt.event package.

The Delegation Event Model

The modern approach to handling events is based on the delegation event model. A source generates an event and sends it to one or more listeners. The listener simply waits until it receives an event. Once received, the listener processes the event and then returns. The advantage of this design is that the application logic that processes events is cleanly separated from the user interface logic that generates those events. Listeners must register with a source in order to receive an event notification. This provides an important benefit which is that notifications are sent only to listeners that want to receive them.   more...

FURTHER READING  


Java Event Handling (Part-2)

Java Event Handling (Part-3) 

0 comments:

Post a Comment