...class button {
int x;
int y;
String name;
int i;
button(String n, int x, int y) {
this.name=n;
this.x=x;
this.y=y;
}
void display() {
fill(#E535A5);
rect(x, y, 160, 50);
textSize(20);
fill(0);
if ((mousePressed&&mouseX>=x&&mousePressed&&mouseX<=x+80)&&(mousePressed&&mouseY>=y&&mousePressed&&mouseY<=y+50)) {
text("Panadda ", 100, 110);
}else {
text("Click ", 120, 110);
}
}
void click() {
if ((mousePressed&&mouseX>=x&&mousePressed&&mouseX<=x+80)&&(mousePressed&&mouseY>=y&&mousePressed&&mouseY<=y+50)) {
if (i%8==0) {
println(this.name);
}
i=i+1;
}
}
}
void setup() {
size(300, 300);
}
void draw() {
background(0);
button a =new button("Panadda", 65, 80);
a.display();
a.click();
}