-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw.java
69 lines (55 loc) · 1.85 KB
/
draw.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
65
66
67
68
69
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.awt.Color;
public class Draw {
// Draw UI
public static void ui() throws FileNotFoundException {
StdDraw.picture(960.0, 60.0, "ui.png");
StdDraw.textLeft(1830, 1030, "X: " + StdDraw.mouseX());
StdDraw.textLeft(1830, 1000, "Y: " + StdDraw.mouseY());
StdDraw.picture(1550, 65, "save.png");
}
// Select colors
public static Color checkColors(double x) {
Color c = StdDraw.BLACK;
if(x < 1091 && !(x < 1010)){
c = StdDraw.WHITE;
StdDraw.setPenColor(StdDraw.WHITE);
}else if(x < 1010 && !(x < 910)){
c = StdDraw.BLACK;
StdDraw.setPenColor(StdDraw.BLACK);
}else if(x < 910 && !(x < 810)){
c = StdDraw.GRAY;
StdDraw.setPenColor(StdDraw.GRAY);
}else if(x < 810 && !(x < 710)){
c = StdDraw.MAGENTA;
StdDraw.setPenColor(StdDraw.MAGENTA);
}else if(x < 710 && !(x < 610)){
c = StdDraw.PINK;
StdDraw.setPenColor(StdDraw.PINK);
}else if(x < 610 && !(x < 510)){
c = StdDraw.BLUE;
StdDraw.setPenColor(StdDraw.BLUE);
}else if(x < 510 && !(x < 410)){
c = StdDraw.CYAN;
StdDraw.setPenColor(StdDraw.CYAN);
}else if(x < 410 && !(x < 310)){
c = StdDraw.GREEN;
StdDraw.setPenColor(StdDraw.GREEN);
}else if(x < 310 && !(x < 210)){
c = StdDraw.YELLOW;
StdDraw.setPenColor(StdDraw.YELLOW);
}else if(x < 210 && !(x < 110)){
c = StdDraw.ORANGE;
StdDraw.setPenColor(StdDraw.ORANGE);
}else if(x < 110){
c = StdDraw.RED;
StdDraw.setPenColor(StdDraw.RED);
}
return c;
}
/*
//BLACK //BLUE //CYAN //GRAY //GREEN //MAGENTA //ORANGE //PINK //RED //WHITE //YELLOW
*/
}