int x = 400; int y = 400; int w = 200; int h = 100; void setup() { size(800,800); } void draw() { background(255); stroke(255); if ((mouseX >= x) && (mouseX <= x+w) && (mouseY >= y) && (mouseY <= y+h)) fill(0); else fill(255,0,0); rect(x,y,w,h); }