class ColorGen { int num; int boxSelect; ColorGen (int n) { num = n; boxSelect = 0; } void generate() { for (int i = 0; i < num; i++){ color c = get(int(random(imgWidth)), int(random(imgHeight))); colors[i] = c; } } void press () { for (int i = 0; i < num; i++){ if ((mouseX > 500) && (mouseX < boxWidth+500) && (mouseY > i*boxHeight+60) && (mouseY < i*boxHeight+boxHeight+60)){ boxSelect = i; } else if (mouseX < 500){ noStroke(); colors[boxSelect] = img.get(mouseX, mouseY); color c = colors[boxSelect]; //redraw color boxes colorBox.display(); } } } }