What is the relationship between an event-listener interface and an event-adapter class? An event-listener interface allows describing the methods which must be implemented by one of the event handler for a specific event.
An event-adapter allows default implementations of an event-listener interface of a specific event. What is the relationship between an event-listener interface and an event-adapter class? If an event listener is implemented directly by a class, all the methods within that interface need to be implemented making the code unnecessarily large.
This issue can be solved using the adapter class. To use an adapter, you create a subclass of it and override only the methods of interest, rather than directly implementing all methods of the listener interface.
|