Overview of listening to events

 

General remarks

It is almost impossible to write a Java application without having to listen to events, such as clicking on a button, selecting a text field or moving a gauge for example.

 

 

Aim of the pattern

The "Listening to events" pattern allows you to subscribe to events, and to create the internal classes that will manage the listening, as well as the methods for answering the notifications.

 

 

Prerequisite

The "Listening to events" pattern can be applied to any simple association or attribute, provided the events exist on the attribute's class or the association's target class.

 

The classes for which events exist are the classes of the JDK's AWT or SWING components, as well as the classes on the attributes or associations to which you have applied the event sending pattern described above.