Here is the revised MousePressedListener class using inheritance from the MouseAdapter class:
class MousePressListener extends MouseAdapter
{
public void mousePressed(MouseEvent event)
{
int x = event.getX();
int y = event.getY();
component.moveTo(x, y);
}
// Other methods in the MouseListener class are inherited
// from MouseAdapter (they do nothing)
}