A Randomly Colored 8 X 8 Board
We want to create an applet that draws an 8 X 8 board with each square randomly colored.
Let's say that each square has an edge length of 40 pixels.
We need to know about
Color
, a Java object.
We can construct a
Color
with a
Color
constructor
(a kind of
method
) that takes 3
float
arguments
.
These 3 arguments represent a quantity of:
red
green
blue
each in the interval [0, 1].
For example,
Color(0.0, 0.0, 0.0) is black
Color(1.0, 1.0, 1.0) is white
Color(1.0, 0.0, 0.0) is
red
Color(0.0, 1.0, 0.0) is
green
Color(0.0, 0.0, 1.0) is
blue
Color(1.0, 0.0, 1.0) is bright
purple
Ok, let's begin to create this applet!