Java Genesis

Hints for Chapter 10: Graphical Components

Problem 1: a window with two panels

To get the square to toggle when the mouse enters the panel on the left, all we need to do is change the anonymous inner class in the constructor method of the class ToggleSquarePanel so that it is the method mouseEntered (rather than the method mousePressed) that is redefined.

Try this before looking at the next hint.

Next Hint