Can I have a MouseListener without implementing all of the methods?

Currently my class implements MouseListener and I have to implement all of the abstract methods (mouseEntered, mouseExited, etc.). However, the only one I use is mouseClicked. Is there a way to not implement all of the unused methods?
[241 byte] By [jamdra] at [2007-10-1 0:04:50]
# 1
Could you extend MouseAdapter or do you extend another class?
howacuna at 2007-7-7 15:48:52 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 2

Yes, ALL of the methods must be implemented in a concrete class before you can use the class, otherwise it is an abstract class.

But like the previous poster noted, MouseAdapter was created for exactly this purpose. It has a default implementation for every required method so you only have to write the ones you are interested in.

mitekea at 2007-7-7 15:48:52 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...