-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathslider.java
More file actions
49 lines (46 loc) · 950 Bytes
/
slider.java
File metadata and controls
49 lines (46 loc) · 950 Bytes
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
class Slider{
boolean here = true;
int x; int y;
int c = 30; int d;
int w; int h;
Slider (int x, int y, int w, int h){
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.d = (80*h)/100;
}
Slider (int x, int y, int w, int h, boolean here){
this.here = here;
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.d = (80*h)/100;
}
void clicked() {
if ((mouseX >= x) && (mouseX <= x+w) && (mouseY >= y) && (mouseY <= y+h)) {
here = true;
}
here = false;
}
void drawy(){
if(here){
fill(blue);
rect(x,y,w,h,6000);
stroke(black); //black
fill(white); //white
strokeWeight(0.05*d);
ellipse(x+h/2,y+h/2,d,d);
strokeWeight(0);
}else{
fill(red);
rect(x,y,w,h,6000);
stroke(black);
fill(white);
strokeWeight(0.05*d);
ellipse(w+x-h/2,y+h/2,d,d);
strokeWeight(0);
}
}
}