
When you need to imple-
ment only a few methods
of a listener interface hav-
ing more than one method,
consider extending the cor-
responding adapter class
instead.
SOFTWARE
ENGINEERING TIP
12.12 Mouse Movements 873
TABLE 12.18 Useful Methods of the MouseEvent Class
Return value Method name and argument list
int getX( )
returns the x value of the ( x,y) coordinate of the mouse activity
int getY( )
returns the y value of the ( x,y) coordinate of the mouse activity
Listener interfaces, each of which has only one method. For mouse events,
there are two listeners: the MouseListener and the MouseMotionListener.
The MouseListener interface specifies five methods to ...