Three By Three Images

Three By Three Images Applet: You will recreate this applet. Each dot you see in the applet area is a three by three image. Which means that each image contains a total of nine pixels.

In this example each pixel in each image is set individually. Here are the basic steps you must follow for each image.

Step One: Declare an instance of the Image class like this:

   Image one;

Step Two: Each image must have it's own array of integers which gets declared like this:

   int pixel[] = new int[9];

Step Three: The elements of each array must be populated which can be done like this:

   pixel[0]=red;  pixel[1]=red;  pixel[2]=red;
   pixel[3]=red;  pixel[4]=red;  pixel[5]=red;
   pixel[6]=red;  pixel[7]=red;  pixel[8]=red;

The variable red is an integer value representing the RGB value for red.
Step Four: Define each image like this:

    one = createImage(new MemoryImageSource(3,3,pixel,0,3));