O'Reilly logo

The class of Java by Pravin Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 19

GUI—Events

What is an event? Anything that happens is an event. How is event handling done in Java? Since Jdk1.1 the observer pattern is followed for handling of most of the GUI events in Java. The model being followed is popularly known as an event delegation model.

19.1 EVENT DELEGATION MODEL

In the event delegation model, there are three kinds of objects which participate. One is the event source, the object where the event takes place. The second is the EventObject, the object which encapsulates information about the event that takes place and the third is the EventListener, the component which is interested in handling (listening for) the events of a particular type on particular event sources. Here the EventListener is an interface. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required