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.


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. ...

Get The class of Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.