Home Segments Top Top Previous Next

779: Mainline

You have implemented a window listener by defining a subclass of the WindowAdapter class, which implements the WindowListener interface. Now, you proceed to implement a mouse listener by defining a subclass of the MouseAdapter class, which implements the MouseListener interface.

The MouseListener interface insists on the definition of several methods, one of which is the mouseClicked method, which is defined as a do-nothing method in the MouseAdapter class. In your subclass of the MouseAdapter class, you arrange for the mouseClicked method to reach into the view that produced the mouse event, to fetch a value, and to relay that value to model setters.