import java.awt.*; public class RectangleTarget extends BApplet { Rectangle targetRect1, targetRect2; void setup() { size(200,200); targetRect1 = new Rectangle(75,75,50,50); targetRect2 = new Rectangle(150,120,30,75); } void loop() { background(0); if (targetRect1.contains(mouseX,mouseY)) { fill(255); } else { fill(100); } rect(targetRect1.x, targetRect1.y, targetRect1.width,targetRect1.height); if (targetRect2.contains(mouseX,mouseY)) { fill(255); } else { fill(100); } rect(targetRect2.x, targetRect2.y, targetRect2.width,targetRect2.height); } }