In designing classes for event handling, typically there is a class that defines the components where the response to the event is supposed to be performed. It is the most straightforward to make this class implement the listener for those events. |
In large applications, some Java experts recommend that it is a better design to always make the event listener class a separate class. They find that they can make event listener classes generic enough so that they can reuse a class such as
|