// and colored boxes are organized 
coloredBox[] boxes; // an array of colored boxes
   color[] cols = { // colors for the boxes
   color(255, 142, 142), 
   color(142, 250, 255), 
   color(142, 255, 205), 
   color(255), 
   color(127), 
   color(69, 227, 2), 
   color(227, 216, 2), 
   color(255, 255, 0), 
   color(227, 126, 2)
   };
void setup() {
   size(500, 500);
   smooth();
 // create the boxes array
   boxes = new coloredBox[9];
 // create individual boxes
   int i=0;
   float bw = width/3;
   float bh = height/3;
 for (int r = 0; r < 3; r++) {
   for (int c = 0; c < 3; c++) {
   boxes[i] = new coloredBox(c*bw, r*bh, bw, bh, int(random(10, 30)), cols[i]);
   i = i+1;
   }
   }
   } // setup()
void draw() {
   background(255);
 // update & display all boxes
   for (int i=0; i < 9; i++) {
   boxes[i].update();
   boxes[i].display();
   }
   } // draw()