What is adapter class?

chinmay.sahoo

New member
An adapter class provides an empty implementation of all methods in an event listener interface. Adapter classes are useful when you want to receive and process only some of the events that are handled by a particular event listener interface. You can define a new class to act listener by extending one of the adapter classes and implementing only those events in which you are interested. For example, the MouseMotionAdapter class has two methods, mouseDragged()and mouseMoved(). The signatures of these empty are exactly as defined in the MouseMotionListener interface. If you are interested in only mouse drag events, then you could simply extend MouseMotionAdapter and implement mouseDragged() .
 
An adapter class provides the default implementation of all methods in an event listener interface. Adapter classes are very useful when you want to process only few of the events that are handled by a particular event listener interface.

Bulkmailstack
 
An adapter is one of the classic design patterns. It is also a class in Java that implements an interface with a set of dummy methods. It lets you rapidly implement an interface.
 
The Adapter class provides the default modification of all methods of an interface, we don't need to modify all the methods of the interface so we can say it reduces coding burden. The adapter class is very helpful since it already modifies all the methods of an interface and by implementing the Adapter class, we only need to modify the required methods.
 
An adapter class provides the default implementation of all methods in an event listener interface. Adapter classes are very useful when you want to process only few of the events that are handled by a particular event listener interface.
 
An adapter class provides the default implementation of all methods in an event listener interface. Adapter classes are very useful when you want to process only few of the events that are handled by a particular event listener interface. You can define a new class by extending one of the adapter classes and implement only those events relevant to you.
 
The adapter classes are found in java.awt.event, java.awt.dnd and javax.swing.event packages. An adapter class provides the default implementation of all methods in an event listener interface.
 
Back
Top