-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTickBox.java
64 lines (59 loc) · 1.56 KB
/
TickBox.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
String[] KitchenJobs = {"Clear the Toaster Crumb Tray",
"Descale the Kettle",
"Wipe down the oven/microwave",
"Wash the Hob",
"Disinfect countertops",
"Clean chopping boards"};
String[] MoppingJobs = {"Mop the Kitchen",
"Mop the back entrance"};
String[] HooverJobs = {"Hoover Upstairs",
"Hoover Downstairs",
"Hoover Stairs"};
String[] BinJobs = {"Take out main bins",
"Empty general waste",
"Empty recycling",
"Empty bag bag",
"Empty composte"};
/*void draw() {
for(int i = 0; i < KitchenJobs.length; i++){
TickBox test = new TickBox(100, 100 + 80*i, 50, KitchenJobs[i]);
test.drawy();
}
}*/
class TickBox {
int x;
int y;
int r;
String job;
boolean ticked = true;
TickBox(int x, int y, int r, String job) {
this.x = x;
this.y = y;
this.r = r;
this.job = job;
}
void drawy() {
if (ticked) {
fill(blue);
stroke(black);
rect(x, y, r, r);
strokeWeight(r/10);
} else {
fill(red);
stroke(black);
rect(x, y, r, r);
strokeWeight(r/10);
}
fill(black);
textSize(r);
textAlign(LEFT,CENTER);
text(" : " + job, (x + 1.25*r), y + 0.35*r);
}
boolean clicked() {
if ((mouseX >= x) && (mouseX <= x+r) && (mouseY >= y) && (mouseY <= y+r)) {
ticked = !ticked;
return true;
}
return false;
}
}