Event-listener interface and an event-adapter class

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.
What is the purpose of the enableEvents() method?
To enable a particular event of an object, the enableEvents() method is utilized...
Difference between the File and RandomAccessFile classes in Java?
The OS based file system services such as creating folders, files, verifying the permissions, changing file names etc...
What are synchronized methods and synchronized statements in Java?
Synchronized methods are utilized to control the access to an object especially in multi threaded programming....
Post your comment