Upload Code
loading-left
loading loading loading
loading-right

Loading

Profile
No self-introduction
codes (1)
Random Color Grid
no vote
import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class RandomColorGrid extends Applet { ColorSwatchCanvas canvas0, canvas1, canvas2, canvas3; // canvases to be displayed in applet Thread runner; // A thread that randomly changes the color of a canvas every so often. // Note that all synchronization in this applet is done on the Thread object. volatile int status; // Status variable for controlling the thread. final static int GO = 0, SUSPEND = 1, TERMINATE = 2; // Possible values for status variable. class Runner extends Thread { // The runner for the RandomColorGrid canvas will be an // object belonging to this nested class. public void run() { // Run method picks a random canvas, changes it's color, then waits for // a random time between 30 and 3029 milliseconds, and then repeats. while (status != TERMINATE)
aprinel
2018-06-24
0
1
No more~