-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui.pde
More file actions
133 lines (116 loc) · 4.2 KB
/
gui.pde
File metadata and controls
133 lines (116 loc) · 4.2 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* =========================================================
* ==== WARNING ===
* =========================================================
* The code in this tab has been generated from the GUI form
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
* =========================================================
*/
synchronized public void win_draw1(PApplet appc, GWinData data) { //_CODE_:window1:335117:
appc.background(230);
fill(50);
/*text("Weight:", 10, 130, 100, 20);
/*text("N:", 185, 140, 20,20);
text("k:", 160, 140, 20,20);
text("M:", 185, 160, 20,20);
text("l:", 160, 160, 20,20);
fill(10);
text("u knots:", 105, 140, 100,20);
text("v knots:", 105, 160, 100,20);*/
} //_CODE_:window1:335117:
// Variable declarations
// autogenerated do not edit
GWindow window1;
GTextField nInput;
GTextField mInput;
GTextField kInput;
GTextField lInput;
GTextField wtInput;
GTextField uKnotsInput;
GTextField vKnotsInput;
GLabel nLabel;
GLabel mLabel;
GLabel kLabel;
GLabel lLabel;
GLabel wtLabel;
GLabel uLabel;
GLabel vLabel;
public void handleTextEvents(GEditableTextControl textcontrol, GEvent event) {
if(textcontrol == nInput && event == GEvent.ENTERED){
NVAL = new Integer(nInput.getText());
}//user entered value for N
else if(textcontrol == mInput && event == GEvent.ENTERED){
MVAL = new Integer(mInput.getText());
}//user entered value for M
else if(textcontrol == wtInput && event == GEvent.ENTERED){
//if(selectedRow < sur.vertices.size() && selectedCol < sur.vertices.get(selectedRow).size()){
sur.vertices.get(selectedRow).get(selectedCol).wt = new Float(wtInput.getText());
//}//in bounds
}//user entered value for wt
else if(textcontrol == kInput && event == GEvent.ENTERED){
KVAL = new Integer(kInput.getText());
setKnots();
}//user entered value for k
else if(textcontrol == lInput && event == GEvent.ENTERED){
LVAL = new Integer(lInput.getText());
setKnots();
}//user entered value for l
else if(textcontrol == uKnotsInput && event == GEvent.ENTERED){
ubar = parseKnots(uKnotsInput.getText());
printKnots();
}//user entered for u knots
else if(textcontrol == vKnotsInput && event == GEvent.ENTERED){
vbar = parseKnots(vKnotsInput.getText());
printKnots();
}//user entered for v knots
}//textfield handler
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
surface.setTitle("3D NURBS Editor");
//second window
window1 = GWindow.getWindow(this, "Controls", 100, 100, 300, 200, JAVA2D);
window1.noLoop();
window1.addDrawHandler(this, "win_draw1");
//add gui elements
//N input
nInput = new GTextField(window1, 30, 10, 30, 15, G4P.SCROLLBARS_NONE);
String tmp = ""+NVAL;
nInput.setText(tmp);
nLabel = new GLabel(window1, 10, 10, 20, 15, "N:");
//M input
mInput = new GTextField(window1, 30, 30, 30, 15);
tmp = ""+MVAL;
mInput.setText(tmp);
mLabel = new GLabel(window1, 10, 30, 20, 15, "M:");
//k input
kInput = new GTextField(window1, 100, 10, 40, 15);
tmp = ""+KVAL;
kInput.setText(tmp);
kLabel = new GLabel(window1, 80, 10, 20, 15, "k:");
//l input
lInput = new GTextField(window1, 100, 30, 40, 15);
tmp = ""+LVAL;
lInput.setText(tmp);
lLabel = new GLabel(window1, 80, 30, 20, 15, "l:");
//wt input
wtInput = new GTextField(window1, 65, 90, 40, 15);
tmp = ""+sur.vertices.get(selectedRow).get(selectedCol).wt;
wtInput.setText(tmp);
wtLabel = new GLabel(window1, 10, 90, 55, 15, "Weight:");
//knots
uKnotsInput = new GTextField(window1, 50, 140, 180, 15);
uLabel = new GLabel(window1, 30, 140, 20, 15, "u:");
vKnotsInput = new GTextField(window1, 50, 160, 180, 15);
uLabel = new GLabel(window1, 30, 160, 20, 15, "v:");
//nInput2.addEventHandler(this, "textfield1_change1");
window1.loop();
}