What are Adapter classes?

Ram Pothuraju
Java provides a special feature, called an adapter class that can simplify the creation of event handles in certain situations. An adapter class provides an empty implementation of all methods in an event listener interface. Adapter classes are useful when we want to receive and process only some the events that are handled by a particular event listener interface. We can define a new class to act as an event listener by extending one of the adapter classes and implementing only those events in which we are interested.

Ex of adapter class:

i)                    Component Adapter
ii)                   Container Adapter
iii)                 Focus Adapter
iv)                 Key Adapter
v)                  Mouse Adapter

vi)                 Window Adapter
Tags

Post a Comment

0Comments

Post a Comment (0)