answersLogoWhite

0

An Adapter class is just a "blank" implementation of a Listener interface. They're convenience classes made so you don't need to implement all of the methods of an interface.

A good example is the MouseListener interface. Let's say you want to detect when a user clicks on your Component. You only need to implement the mouseClicked method to get that part working. This will leave you with...

public void mousePressed(MouseEvent e) {

}

public void mouseReleased(MouseEvent e) {

}

public void mouseEntered(MouseEvent e) {

}

public void mouseExited(MouseEvent e) {

}

...at the end of your implementation. Ugly. So Java gives us the MouseAdapter class (which gives us the same empty implementations as above). We can use this in place of a MouseListener to try to keep our code cleaner.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What's the difference between the Class 365 and Class 465 466?

The difference between the Class 365 and Class 465, 466 is basically the cost.


Difference between exclusive or inclusive class intervals?

difference between inclusive and exclusive class interval


What is difference between first class and second class on train trips?

What is the difference between buying a 1st class and a 2nd class ticket on the train in England?


What is the price difference between first class and economy class tickets for this flight?

The price difference between first class and economy class tickets for this flight is 500.


What is the difference between a class What is the difference between a class III and class IV hitch and?

class III rated for up to 5,000lbs, class IV is rated for up to 10,000lbs towing capacity


What is the difference between abstract class and final class?

20


Can you use a 15 volt dc adapter to run a 12 volt portable DVD player The adapter in question lists as a class 2 transformer if that makes any difference?

No. You should use the adapter specified for the DVD player. Using the wrong adapter can damage the DVD player and/or the adapter and/or cause a fire.


Difference between Mercedes e class elegance and classic?

What is the difference between Mercedes Benz E class 'Elegance'and classic


What is the difference between classes of IP addresses?

difference between ip address and class


What do you mean by object adapter explain with an example?

The adapter method is when you create a class which wraps around another (holding that other class as a variable). The adapter class then responds to calls by calling the methods of the held variable.


What is the Difference between b and c class MS pipe?

The main difference is the thickness of the pipe Compare to A Class pipe B Class pipe thickness is more.Like that Compare to B class pipe C Class pipe thickness is more.


What is the difference between socioeconomic status and social class?

i think there is no difference between two concepts.