How do I get and set a color value from one class to another?
in
Programming Questions
•
1 years ago
I am new to coding and just made the worse coding architecture ever made so I apologize for the mess.
I am trying to get the color value from my myRandomColorPalette object to color the tile I will click on in myQuiltGrid by assigning it to the variable called tileClr. I think it's an easy get and set methods thing but I just don't know how to do it (I have tried different syntax and it does not work: see the commented out 2 bits of code in the RandomColorPalette class).
I also would like to rotate the tile pattern once it is on the my quilt grid (see void rotatePattern that is commented out in that same section).
QuiltGrid myQuiltGrid;
PFont fontInstructionsPlain; // create a variable to load the font for the instructions in plain font style
PFont fontInstructionsItalic; // create a variable to load the font for the instructions in italic font style
Instructions instruction;
PImage [] hawaiianPattern = new PImage [4]; // declare a variable that stores an array of quilting patterns images from clip art
Pattern [] myPatternTile= new Pattern [4];
RandomColorPalette myRandomColorPalette;
Stitch myFlatStitch;
Stitch myDoubleFlatStitch;
Stitch myCrossStitch;
Stitch myDottedStitch;
/*Stitch myWavyStitch;*/
void setup() { // call the setup function to define initial enviroment properties
size(900, 700); // set the canvas size at 800 pixels by 800 pixels
background(225, 225, 255); // set background color to light gray
myQuiltGrid= new QuiltGrid (color(255, 211, 232), 100, 200, 200);
fontInstructionsPlain=loadFont("SansSerif.plain-48.vlw"); // load the font used for the text in a data file attached to this file
fontInstructionsItalic=loadFont("SansSerif.italic-48.vlw"); // load the font used for the text in a data file attached to this file
textFont (fontInstructionsPlain, 16); // set the loaded font as the current one to use
instruction=new Instructions (color(0,0,0), 0,0,0);
for (int q = 0; q < hawaiianPattern.length; q++) { // create an array that loads the array of quilt patterns as numbered files
hawaiianPattern[q] = loadImage("pattern" + (q+1) + ".gif"); // load each quilt pattern individually based on its numbered file
} // end the for loop for loading the array of quilt patterns as numbered files
for (int q = 0; q < myPatternTile.length; q++) { // create an array that initializes each hawaiian pattern tile
myPatternTile[q]=new Pattern (color(255, 255, 255), 100, 0, 150+q*150, hawaiianPattern[q]);
}
myRandomColorPalette=new RandomColorPalette (color(255, 255, 255), 100, 0, 0);
myFlatStitch=new Stitch (color(250, 100, 90), 100, 200, 0, 10, 6.6);
myDoubleFlatStitch=new Stitch (color(250, 100, 90), 100, 400, 0, 10, 5.0, 6.6);
myDottedStitch=new Stitch (color(227, 208, 140), 100, 600, 0, 10, 4);
myCrossStitch=new Stitch (color(227, 101, 221), 100, 800, 0, 10);
myQuiltGrid.display();
} // end the setup function
void draw () { // call the draw function
myQuiltGrid.testMousePressed(mouseX, mouseY);
myRandomColorPalette.display();
myFlatStitch.display(); // draws the box for the flat stitch
myDoubleFlatStitch.display ();
myDottedStitch.display();
myCrossStitch.display();
myFlatStitch.showFlatStitch(10, 6.6);
myDoubleFlatStitch.showDoubleFlatStitch (10, 5.0, 6.6);
myDottedStitch.showDottedStitch(10, 4);
myCrossStitch.showCrossStitch(10);
myFlatStitch.drawFlatStitch(10, 6.6);
myDoubleFlatStitch.drawDoubleFlatStitch (10, 5.0, 6.6);
myDottedStitch.drawDottedStitch(10, 4);
myCrossStitch.drawCrossStitch (10);
for (int q = 0; q < myPatternTile.length; q++) { // create an array that loads the array of quilt patterns as numbered files
myPatternTile[q].showPatternTiles();
myPatternTile[q].tintPattern ();
// myPatternTile[q].rotatePattern();
}
instruction.write();
} // end the draw function
abstract class CanvasBoxes {
color boxClr;
float sizeOfSquares;
float boxPosX;
float boxPosY;
CanvasBoxes (color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY) {
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
} // end of the constructor
boolean mouseClickOverBox () {
if (mousePressed && ((mouseX>boxPosX) && (mouseX<boxPosX+sizeOfSquares) && (mouseY>boxPosY) && (mouseY<boxPosY+sizeOfSquares))) {
return true;
}
else {
return false;
}
} // end of MouseClickOverBox function()
} // end of abstract CanvasBoxes class
class Pattern extends CanvasBoxes {
PImage quiltPattern;
Pattern(color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY, PImage tempQuiltPattern) {
super (tempboxClr, tempsizeOfSquares, tempBoxPosX, tempBoxPosY);
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
quiltPattern=tempQuiltPattern;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
} // end of the constructor
void showPatternTiles() {
image (quiltPattern, boxPosX, boxPosY);
} // end of showPatternTiles () mode
void tintPattern () {
if (mouseClickOverBox()) {
tint (color(random(175, 255), random(175, 255), random(175, 255)));
}
}
} // end of Pattern class
class QuiltGrid extends CanvasBoxes {
ArrayList GridBoxes;
int tileNumber;
QuiltGrid (color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY) {
super (tempboxClr, tempsizeOfSquares, tempBoxPosX, tempBoxPosY);
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
GridBoxes = new ArrayList();
} // end of the constructor
// inner class (class inside QuiltGrid class)
class myQuiltBoxes {
float quiltBoxX;
float quiltBoxY;
float quiltBoxW;
float quiltBoxH;
color tileClr;
myQuiltBoxes(float tempQuiltBoxX, float tempQuiltBoxY, float tempQuiltBoxW, float tempQuiltBoxH) {
quiltBoxX = tempQuiltBoxX;
quiltBoxY = tempQuiltBoxY;
quiltBoxW = tempQuiltBoxW;
quiltBoxH = tempQuiltBoxH;
rect(quiltBoxX, quiltBoxY, quiltBoxW, quiltBoxH);
}
void applyPatternTile() {
image (hawaiianPattern[tileNumber], quiltBoxX, quiltBoxY);
}
void colorTheTile () {
tileClr=200;
fill (tileClr);
rect(quiltBoxX, quiltBoxY, quiltBoxW, quiltBoxH);
}
/* void rotatePattern () {
if ((keyPressed) && (key == 'r' || key == 'R')&& mousePressed) {
pushMatrix();
translate(boxPosX+sizeOfSquares/2, boxPosY+sizeOfSquares/2);
rotate (radians(90));
image (hawaiianPattern[tileNumber], quiltBoxX, quiltBoxY);
popMatrix();
}*/
} // end inner class (class inside QuiltGrid class)
boolean rollOverQuiltGrid() {
if (mouseX >= boxPosX && mouseY >= boxPosY) {
return true;
}
else {
return false;
}
} // end of rollOverQuiltGrid
void testMousePressed(int x, int y) {
if (mousePressed) {
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).colorTheTile ();
}
}
if ((keyPressed) && (key == '1') && mousePressed) {
tileNumber=0;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
if ((keyPressed) && (key == '2') && mousePressed) {
tileNumber=1;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
if ((keyPressed) && (key == '3') && mousePressed) {
tileNumber=2;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
if ((keyPressed) && (key == '4') && mousePressed) {
tileNumber=3;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
}
void display () {
for (float i=boxPosX;i<width;i+=sizeOfSquares) {
for (float j=boxPosY;j<height;j+=sizeOfSquares) {
fill(boxClr);
myQuiltBoxes b = new myQuiltBoxes(i, j, sizeOfSquares, sizeOfSquares);
GridBoxes.add(b);
//((myQuiltBoxes)GridBoxes.get()).printme();
}
}
} // end of the display function
} // end of the Grid class
class RandomColorPalette extends CanvasBoxes {
RandomColorPalette(color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY) {
super (tempboxClr, tempsizeOfSquares, tempBoxPosX, tempBoxPosY);
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
}
/*getTileClr () {
return boxClr;
} */
/*void setTileClr (color boxClr) {
tileClr=boxClr;
}*/
void display () {
fill(boxClr);
rect (boxPosX, boxPosY, sizeOfSquares, sizeOfSquares);
if (mouseClickOverBox()) {
boxClr=(color(random(125, 255), random(125, 255), random(125, 255)));
fill (boxClr);
rect (boxPosX, boxPosY, sizeOfSquares, sizeOfSquares);
}
} // end of the display () function
} // end of the RandomColorPalette class
NOTE: I LEFT OUT TWO CLASSES OF MY CODE BECAUSE THEY DID NOT SEEM RELEVANT
I am trying to get the color value from my myRandomColorPalette object to color the tile I will click on in myQuiltGrid by assigning it to the variable called tileClr. I think it's an easy get and set methods thing but I just don't know how to do it (I have tried different syntax and it does not work: see the commented out 2 bits of code in the RandomColorPalette class).
I also would like to rotate the tile pattern once it is on the my quilt grid (see void rotatePattern that is commented out in that same section).
QuiltGrid myQuiltGrid;
PFont fontInstructionsPlain; // create a variable to load the font for the instructions in plain font style
PFont fontInstructionsItalic; // create a variable to load the font for the instructions in italic font style
Instructions instruction;
PImage [] hawaiianPattern = new PImage [4]; // declare a variable that stores an array of quilting patterns images from clip art
Pattern [] myPatternTile= new Pattern [4];
RandomColorPalette myRandomColorPalette;
Stitch myFlatStitch;
Stitch myDoubleFlatStitch;
Stitch myCrossStitch;
Stitch myDottedStitch;
/*Stitch myWavyStitch;*/
void setup() { // call the setup function to define initial enviroment properties
size(900, 700); // set the canvas size at 800 pixels by 800 pixels
background(225, 225, 255); // set background color to light gray
myQuiltGrid= new QuiltGrid (color(255, 211, 232), 100, 200, 200);
fontInstructionsPlain=loadFont("SansSerif.plain-48.vlw"); // load the font used for the text in a data file attached to this file
fontInstructionsItalic=loadFont("SansSerif.italic-48.vlw"); // load the font used for the text in a data file attached to this file
textFont (fontInstructionsPlain, 16); // set the loaded font as the current one to use
instruction=new Instructions (color(0,0,0), 0,0,0);
for (int q = 0; q < hawaiianPattern.length; q++) { // create an array that loads the array of quilt patterns as numbered files
hawaiianPattern[q] = loadImage("pattern" + (q+1) + ".gif"); // load each quilt pattern individually based on its numbered file
} // end the for loop for loading the array of quilt patterns as numbered files
for (int q = 0; q < myPatternTile.length; q++) { // create an array that initializes each hawaiian pattern tile
myPatternTile[q]=new Pattern (color(255, 255, 255), 100, 0, 150+q*150, hawaiianPattern[q]);
}
myRandomColorPalette=new RandomColorPalette (color(255, 255, 255), 100, 0, 0);
myFlatStitch=new Stitch (color(250, 100, 90), 100, 200, 0, 10, 6.6);
myDoubleFlatStitch=new Stitch (color(250, 100, 90), 100, 400, 0, 10, 5.0, 6.6);
myDottedStitch=new Stitch (color(227, 208, 140), 100, 600, 0, 10, 4);
myCrossStitch=new Stitch (color(227, 101, 221), 100, 800, 0, 10);
myQuiltGrid.display();
} // end the setup function
void draw () { // call the draw function
myQuiltGrid.testMousePressed(mouseX, mouseY);
myRandomColorPalette.display();
myFlatStitch.display(); // draws the box for the flat stitch
myDoubleFlatStitch.display ();
myDottedStitch.display();
myCrossStitch.display();
myFlatStitch.showFlatStitch(10, 6.6);
myDoubleFlatStitch.showDoubleFlatStitch (10, 5.0, 6.6);
myDottedStitch.showDottedStitch(10, 4);
myCrossStitch.showCrossStitch(10);
myFlatStitch.drawFlatStitch(10, 6.6);
myDoubleFlatStitch.drawDoubleFlatStitch (10, 5.0, 6.6);
myDottedStitch.drawDottedStitch(10, 4);
myCrossStitch.drawCrossStitch (10);
for (int q = 0; q < myPatternTile.length; q++) { // create an array that loads the array of quilt patterns as numbered files
myPatternTile[q].showPatternTiles();
myPatternTile[q].tintPattern ();
// myPatternTile[q].rotatePattern();
}
instruction.write();
} // end the draw function
abstract class CanvasBoxes {
color boxClr;
float sizeOfSquares;
float boxPosX;
float boxPosY;
CanvasBoxes (color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY) {
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
} // end of the constructor
boolean mouseClickOverBox () {
if (mousePressed && ((mouseX>boxPosX) && (mouseX<boxPosX+sizeOfSquares) && (mouseY>boxPosY) && (mouseY<boxPosY+sizeOfSquares))) {
return true;
}
else {
return false;
}
} // end of MouseClickOverBox function()
} // end of abstract CanvasBoxes class
class Pattern extends CanvasBoxes {
PImage quiltPattern;
Pattern(color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY, PImage tempQuiltPattern) {
super (tempboxClr, tempsizeOfSquares, tempBoxPosX, tempBoxPosY);
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
quiltPattern=tempQuiltPattern;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
} // end of the constructor
void showPatternTiles() {
image (quiltPattern, boxPosX, boxPosY);
} // end of showPatternTiles () mode
void tintPattern () {
if (mouseClickOverBox()) {
tint (color(random(175, 255), random(175, 255), random(175, 255)));
}
}
} // end of Pattern class
class QuiltGrid extends CanvasBoxes {
ArrayList GridBoxes;
int tileNumber;
QuiltGrid (color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY) {
super (tempboxClr, tempsizeOfSquares, tempBoxPosX, tempBoxPosY);
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
GridBoxes = new ArrayList();
} // end of the constructor
// inner class (class inside QuiltGrid class)
class myQuiltBoxes {
float quiltBoxX;
float quiltBoxY;
float quiltBoxW;
float quiltBoxH;
color tileClr;
myQuiltBoxes(float tempQuiltBoxX, float tempQuiltBoxY, float tempQuiltBoxW, float tempQuiltBoxH) {
quiltBoxX = tempQuiltBoxX;
quiltBoxY = tempQuiltBoxY;
quiltBoxW = tempQuiltBoxW;
quiltBoxH = tempQuiltBoxH;
rect(quiltBoxX, quiltBoxY, quiltBoxW, quiltBoxH);
}
void applyPatternTile() {
image (hawaiianPattern[tileNumber], quiltBoxX, quiltBoxY);
}
void colorTheTile () {
tileClr=200;
fill (tileClr);
rect(quiltBoxX, quiltBoxY, quiltBoxW, quiltBoxH);
}
/* void rotatePattern () {
if ((keyPressed) && (key == 'r' || key == 'R')&& mousePressed) {
pushMatrix();
translate(boxPosX+sizeOfSquares/2, boxPosY+sizeOfSquares/2);
rotate (radians(90));
image (hawaiianPattern[tileNumber], quiltBoxX, quiltBoxY);
popMatrix();
}*/
} // end inner class (class inside QuiltGrid class)
boolean rollOverQuiltGrid() {
if (mouseX >= boxPosX && mouseY >= boxPosY) {
return true;
}
else {
return false;
}
} // end of rollOverQuiltGrid
void testMousePressed(int x, int y) {
if (mousePressed) {
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).colorTheTile ();
}
}
if ((keyPressed) && (key == '1') && mousePressed) {
tileNumber=0;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
if ((keyPressed) && (key == '2') && mousePressed) {
tileNumber=1;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
if ((keyPressed) && (key == '3') && mousePressed) {
tileNumber=2;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
if ((keyPressed) && (key == '4') && mousePressed) {
tileNumber=3;
for (int i=0; i < GridBoxes.size(); i++) {
if (x >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX) && x <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxX)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxW)) && y >= (((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY) && y <= ((((myQuiltBoxes)GridBoxes.get(i)).quiltBoxY)+(((myQuiltBoxes)GridBoxes.get(i)).quiltBoxH)))
((myQuiltBoxes)GridBoxes.get(i)).applyPatternTile();
}
}
}
void display () {
for (float i=boxPosX;i<width;i+=sizeOfSquares) {
for (float j=boxPosY;j<height;j+=sizeOfSquares) {
fill(boxClr);
myQuiltBoxes b = new myQuiltBoxes(i, j, sizeOfSquares, sizeOfSquares);
GridBoxes.add(b);
//((myQuiltBoxes)GridBoxes.get()).printme();
}
}
} // end of the display function
} // end of the Grid class
class RandomColorPalette extends CanvasBoxes {
RandomColorPalette(color tempboxClr, float tempsizeOfSquares, float tempBoxPosX, float tempBoxPosY) {
super (tempboxClr, tempsizeOfSquares, tempBoxPosX, tempBoxPosY);
boxClr=tempboxClr;
sizeOfSquares=tempsizeOfSquares;
boxPosX=tempBoxPosX;
boxPosY=tempBoxPosY;
}
/*getTileClr () {
return boxClr;
} */
/*void setTileClr (color boxClr) {
tileClr=boxClr;
}*/
void display () {
fill(boxClr);
rect (boxPosX, boxPosY, sizeOfSquares, sizeOfSquares);
if (mouseClickOverBox()) {
boxClr=(color(random(125, 255), random(125, 255), random(125, 255)));
fill (boxClr);
rect (boxPosX, boxPosY, sizeOfSquares, sizeOfSquares);
}
} // end of the display () function
} // end of the RandomColorPalette class
NOTE: I LEFT OUT TWO CLASSES OF MY CODE BECAUSE THEY DID NOT SEEM RELEVANT
1