import objectdraw.*; import java.awt.*; // A program to simulate the brightening of the sky at sunrise public class LightenUp extends FrameWindowController { private FilledRect sky; // background rectangle private int brightness; // brightness of sky's color private FilledOval sun; // Circle that represents the sun public void begin() { // Create the sky and make it a dark gray brightness = 50; sky = new FilledRect( 0, 0, canvas.getWidth(), canvas.getHeight(), canvas ); sky.setColor( new Color( brightness, brightness, brightness)); // Place the sun and some brief instructions on the screen sun = new FilledOval( 50, 150, 100, 100, canvas); new Text( "Please click the mouse repeatedly", 20, 20, canvas); } // Brighten the sky and move the sun with each click public void onMouseClick(Location point) { brightness = brightness + 5; sky.setColor( new Color(brightness, brightness, brightness)); sun.move(0, -5); } }