adapter class ?

Answer Posted / janet

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 lisener by
extending one of the adapter classes and implementing onlu
those events in which you are interested.
For ex: the MouseMotionListenerAdapter 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
onlu mouse drag events,that you could simply extend
MouseMotionAdapter and implement mouseDragged().

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between variable declaration and definition?

515


Is java type safe?

514


Can a class be private or protected in java?

558


Is arraylist a class in java?

538


What is java util collection?

561






how would you implement a thread pool? : Java thread

510


What is skeleton and stub?

592


What are instance variables?

613


What will be the output of round(3.7) and ceil(3.7)?

683


What is the purpose of the strictfp keyword?

610


Is there any difference between nested classes and inner classes?

541


What is object class in java?

505


What is the purpose of the enableevents() method in java programming?

590


How arrays are stored in memory in java?

513


What is java Applet?

652