What is event adapter class? When should we use an event adapter class?

What is event adapter class? When should we use an event adapter class?

- It is a pattern which provides default implementation of interface or abstract class.

- Adapter class provides the default implementation of all the methods in an event listener interface.

- Usually adapter classes ease the programmers by providing the implementations of the listener interfaces instead of having to implement them. This is where the event adapter class comes into picture.

- These classes are useful when you want to process only few of the events that are handled by a particular event listener interface.

- Using adapters it helps to reduce the clutter in your code.

Advantages of the Adapter class:

- It increases the transparency of classes.

- It makes a class highly reusable.

- It provides a pluggable kit for developing application.

- It provides a way to include related patterns in a class.
What is the relationship between clipping and repainting?
Clipping and repainting - Clipping is the process of confining paint operations to a limited area or shape...
What is the relationship between an event-listener interface and an event-adapter class?
Event-listener interface and an event-adapter class - When you declare to implement an event listener, then you should write the definitions of all the methods that have been declared in the interface...
Difference between the paint() and repaint() methods
paint() and repaint() methods - The paint() method is called when some action is performed on the window...
Post your comment