1 | We set up a test program that creates three movable objects, a rectangle, circle and triangle, as in the earlier example. In this program, we start with them all red. Whenever the mouse is detected to be over one of the objects, its color is changed to cyan. If the mouse button is used to drag the object, we move the object to the mouse location. |
2 | Note that it is not necessary to introduce a thread for this applet since it is not running continuously - it is mostly waiting for mouse events. |