-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGUI
100 lines (84 loc) · 2.03 KB
/
GUI
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//stores user input for absolute path string
String typedText = "Type abs path here";
PFont other;
void setup() {
size(500,500);
background(0,100,255);
fill(204,102,0);
rect(100,250,283,25);
rect(140,300,215,25);
rect(140,350,215,25);
PFont font = loadFont("SansSerif-48.vlw");
textFont(font, 20);
String DRC = "Dynamic Range Compression";
String FFR = "File Frequency Reader";
String MFR = "Mic Frequency Reader";
String please = "Select file to be processed, if applicable:";
/*
float tS=100;
//the textSize() is shorten by 1 until the textWidth() smaller then the width of the rect
while(textWidth(s)>100){
tS-=1;
textSize(tS);
println(textWidth(s));
}
fill(0);
//draw the text in the middle of the rect
text(s,50+(100-textWidth(s))/2,50+100/2+tS/2);
*/
fill(255,90,0);
textFont(font, 50);
text("Please select one:", 50, 150);
fill(0);
textFont(font, 20);
text(DRC,100,270);
text(FFR,140,320);
text(MFR,140,370);
text(please,50,425);
//text(typedText+(frameCount/10 % 2 == 0 ? "_" : ""),75,400);
}
void draw() {
fill(255,90,0);
rect(75,430,300,25);
fill(0);
text(typedText,75,455);
System.out.println(typedText);
}
void mousePressed() {
if (mouseX >= 100 && mouseX <= 383 && mouseY >= 250 && mouseY <= 275) {
rect(0,0,10,10);
Scanner scan = new Scanner(System.in);
System.out.println("Type in File Name: ");
String s = scan.next();
}
if(mouseX >= 140 && mouseX <= 355 && mouseY >= 300 && mouseY <= 325) {
fill(255);
rect(0,0,10,10);
}
if(mouseX >= 140 && mouseX <= 355 && mouseY >= 350 && mouseY <= 375) {
fill(90);
rect(0,0,10,10);
}
}
void keyReleased() {
if (key != CODED) {
switch(key) {
case BACKSPACE:
typedText = typedText.substring(0,max(0,typedText.length()-1));
break;
case TAB:
typedText += " ";
break;
case ENTER:
case RETURN:
// comment out the following two lines to disable line-breaks
typedText += "\n";
break;
case ESC:
case DELETE:
break;
default:
typedText += key;
}
}
}