Java Applets: Interactive Programming


The purpose of this assignment is


Create an automated animated mosaic!

You can work in pairs on this lab exercise, as it will help figuring out how this works.

To get started, you only need one class (name it Mosaic).

Create the paint method and have it randomly select the x and y coordinates as well as a color, then paint ONE square.
You can test this part until it works.
Hint: determine the width and height of the applet using this.getHeight( ), then based on the size of your square, calculate an x and y coordinate.
Hint 2: store a list of colors in an array, then use Random to select one based on a number between index 0 and the length of the array.

Once that's finished, add the Thread - import, implements, start call and run method.
Inside the run method, you need to loop and call the repaint method.
Don't forget to sleep a little between calls to repaint!

Copyright © 2006-2007: E.S.Boese All rights reserved.