|
@@ -3,7 +3,7 @@ import java.awt.event.*;
|
3
|
3
|
import javax.swing.*;
|
4
|
4
|
|
5
|
5
|
/*
|
6
|
|
- * cube.c
|
|
6
|
+ * frame.java
|
7
|
7
|
*
|
8
|
8
|
* Copyright 2011 Thomas Buck <xythobuz@me.com>
|
9
|
9
|
* Copyright 2011 Max Nuding <max.nuding@gmail.com>
|
|
@@ -28,6 +28,8 @@ import javax.swing.*;
|
28
|
28
|
public class frame extends JFrame {
|
29
|
29
|
// Anfang Variablen
|
30
|
30
|
private Canvas cubeCanvas = new Canvas();
|
|
31
|
+
|
|
32
|
+ // Anfang Attribute
|
31
|
33
|
private JButton editA = new JButton();
|
32
|
34
|
private JButton editB = new JButton();
|
33
|
35
|
private JButton editC = new JButton();
|
|
@@ -37,13 +39,15 @@ public class frame extends JFrame {
|
37
|
39
|
private JButton editG = new JButton();
|
38
|
40
|
private JButton editH = new JButton();
|
39
|
41
|
private DefaultListModel frameListModel = new DefaultListModel();
|
40
|
|
- private JList frameList = new JList(frameListModel);
|
|
42
|
+ private JList frameList = new JList();
|
|
43
|
+ private JScrollPane frameListScrollPane = new JScrollPane(frameList);
|
41
|
44
|
private JButton frameUp = new JButton();
|
42
|
45
|
private JButton frameDown = new JButton();
|
43
|
46
|
private JButton frameAdd = new JButton();
|
44
|
47
|
private JButton frameRemove = new JButton();
|
45
|
|
- private DefaultListModel animationListModel = new DefaultListModel();
|
46
|
|
- private JList jList2 = new JList(animationListModel);
|
|
48
|
+ private JList jList2 = new JList();
|
|
49
|
+ private DefaultListModel jList2Model = new DefaultListModel();
|
|
50
|
+ private JScrollPane jList2ScrollPane = new JScrollPane(jList2);
|
47
|
51
|
private JButton animUp = new JButton();
|
48
|
52
|
private JButton animDown = new JButton();
|
49
|
53
|
private JButton animAdd = new JButton();
|
|
@@ -51,19 +55,19 @@ public class frame extends JFrame {
|
51
|
55
|
private JTextField animPath = new JTextField();
|
52
|
56
|
private JButton load = new JButton();
|
53
|
57
|
private JButton save = new JButton();
|
54
|
|
- private String[] jComboBox1Daten = {"Select serial port..."};
|
55
|
|
- private JComboBox jComboBox1 = new JComboBox(jComboBox1Daten);
|
|
58
|
+ private JComboBox jComboBox1 = new JComboBox();
|
56
|
59
|
private JButton upload = new JButton();
|
57
|
60
|
private JButton download = new JButton();
|
58
|
61
|
private JLabel jLabel4 = new JLabel();
|
59
|
62
|
private JTextField frameRemaining = new JTextField();
|
60
|
|
-
|
|
63
|
+ // Ende Attribute
|
|
64
|
+
|
61
|
65
|
private cubeWorker worker = new cubeWorker();
|
62
|
66
|
// Ende Variablen
|
63
|
67
|
|
64
|
68
|
private int saveExitDialog() {
|
65
|
69
|
String[] Optionen = {"Yes", "No"};
|
66
|
|
- int Auswahl = JOptionPane.showOptionDialog(this, "Save?", "Yes/No", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, Optionen, Optionen[0]);
|
|
70
|
+ int Auswahl = JOptionPane.showOptionDialog(this, "Do you want to save your changes?", "Save?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, Optionen, Optionen[0]);
|
67
|
71
|
if (Auswahl == JOptionPane.YES_OPTION) {
|
68
|
72
|
worker.saveState(animPath.getText());
|
69
|
73
|
return 1;
|
|
@@ -72,16 +76,26 @@ public class frame extends JFrame {
|
72
|
76
|
}
|
73
|
77
|
}
|
74
|
78
|
|
|
79
|
+ private void errorMessage(String s) {
|
|
80
|
+ String[] Optionen = {"OK"};
|
|
81
|
+ JOptionPane.showOptionDialog(this, s, "Error!", JOptionPane.YES_OPTION, JOptionPane.ERROR_MESSAGE, null, Optionen, Optionen[0]);
|
|
82
|
+ }
|
|
83
|
+
|
75
|
84
|
public frame(String title) {
|
76
|
85
|
// Frame-Initialisierung
|
77
|
86
|
super(title);
|
78
|
87
|
|
79
|
|
- frameListModel.add(0, "Frame 1");
|
80
|
|
- frameListModel.add(1, "Frame 2");
|
81
|
|
- frameListModel.add(2, "Frame 3");
|
82
|
|
- animationListModel.add(0, "Animation 1");
|
83
|
|
- animationListModel.add(1, "Animation 2");
|
84
|
|
- animationListModel.add(2, "Animation 3");
|
|
88
|
+ String[] sPorts = worker.getSerialPorts();
|
|
89
|
+ for(int i = 0; i < sPorts.length; i++){
|
|
90
|
+ jComboBox1.addItem(sPorts[i]);
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ for(int i = 0; i < worker.numOfAnimations(); i++){
|
|
94
|
+ jList2Model.addElement(worker.getAnimationName(i));
|
|
95
|
+ }
|
|
96
|
+ for(int i = 0; i < worker.numOfFrames(); i++){
|
|
97
|
+ frameListModel.add(i, worker.getFrameName(i));
|
|
98
|
+ }
|
85
|
99
|
|
86
|
100
|
addWindowListener(new WindowAdapter() {
|
87
|
101
|
public void windowClosing(WindowEvent evt) {
|
|
@@ -91,8 +105,8 @@ public class frame extends JFrame {
|
91
|
105
|
System.exit(0);
|
92
|
106
|
}
|
93
|
107
|
});
|
94
|
|
- int frameWidth = 662;
|
95
|
|
- int frameHeight = 416;
|
|
108
|
+ int frameWidth = 661;
|
|
109
|
+ int frameHeight = 417;
|
96
|
110
|
setSize(frameWidth, frameHeight);
|
97
|
111
|
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
98
|
112
|
int x = (d.width - getSize().width) / 2;
|
|
@@ -107,242 +121,273 @@ public class frame extends JFrame {
|
107
|
121
|
cp.add(cubeCanvas);
|
108
|
122
|
editA.setBounds(264, 8, 107, 25);
|
109
|
123
|
editA.setText("Layer A");
|
|
124
|
+ editA.setFont(new Font("Dialog", Font.PLAIN, 13));
|
110
|
125
|
cp.add(editA);
|
111
|
126
|
editA.addActionListener(new ActionListener() {
|
112
|
127
|
public void actionPerformed(ActionEvent evt) {
|
113
|
|
- editAActionPerformed(evt);
|
|
128
|
+ editA_ActionPerformed(evt);
|
114
|
129
|
}
|
115
|
130
|
});
|
116
|
131
|
|
117
|
132
|
editB.setBounds(264, 40, 107, 25);
|
118
|
133
|
editB.setText("Layer B");
|
|
134
|
+ editB.setFont(new Font("Dialog", Font.PLAIN, 13));
|
119
|
135
|
cp.add(editB);
|
120
|
136
|
editB.addActionListener(new ActionListener() {
|
121
|
137
|
public void actionPerformed(ActionEvent evt) {
|
122
|
|
- editBActionPerformed(evt);
|
|
138
|
+ editB_ActionPerformed(evt);
|
123
|
139
|
}
|
124
|
140
|
});
|
125
|
141
|
|
126
|
142
|
editC.setBounds(264, 72, 107, 25);
|
127
|
143
|
editC.setText("Layer C");
|
|
144
|
+ editC.setFont(new Font("Dialog", Font.PLAIN, 13));
|
128
|
145
|
cp.add(editC);
|
129
|
146
|
editC.addActionListener(new ActionListener() {
|
130
|
147
|
public void actionPerformed(ActionEvent evt) {
|
131
|
|
- editCActionPerformed(evt);
|
|
148
|
+ editC_ActionPerformed(evt);
|
132
|
149
|
}
|
133
|
150
|
});
|
134
|
151
|
|
135
|
152
|
editD.setBounds(264, 104, 107, 25);
|
136
|
153
|
editD.setText("Layer D");
|
|
154
|
+ editD.setFont(new Font("Dialog", Font.PLAIN, 13));
|
137
|
155
|
cp.add(editD);
|
138
|
156
|
editD.addActionListener(new ActionListener() {
|
139
|
157
|
public void actionPerformed(ActionEvent evt) {
|
140
|
|
- editDActionPerformed(evt);
|
|
158
|
+ editD_ActionPerformed(evt);
|
141
|
159
|
}
|
142
|
160
|
});
|
143
|
161
|
|
144
|
162
|
editE.setBounds(264, 136, 107, 25);
|
145
|
163
|
editE.setText("Layer E");
|
|
164
|
+ editE.setFont(new Font("Dialog", Font.PLAIN, 13));
|
146
|
165
|
cp.add(editE);
|
147
|
166
|
editE.addActionListener(new ActionListener() {
|
148
|
167
|
public void actionPerformed(ActionEvent evt) {
|
149
|
|
- editEActionPerformed(evt);
|
|
168
|
+ editE_ActionPerformed(evt);
|
150
|
169
|
}
|
151
|
170
|
});
|
152
|
171
|
|
153
|
172
|
editF.setBounds(264, 168, 107, 25);
|
154
|
173
|
editF.setText("Layer F");
|
|
174
|
+ editF.setFont(new Font("Dialog", Font.PLAIN, 13));
|
155
|
175
|
cp.add(editF);
|
156
|
176
|
editF.addActionListener(new ActionListener() {
|
157
|
177
|
public void actionPerformed(ActionEvent evt) {
|
158
|
|
- editFActionPerformed(evt);
|
|
178
|
+ editF_ActionPerformed(evt);
|
159
|
179
|
}
|
160
|
180
|
});
|
161
|
181
|
|
162
|
182
|
editG.setBounds(264, 200, 107, 25);
|
163
|
183
|
editG.setText("Layer G");
|
|
184
|
+ editG.setFont(new Font("Dialog", Font.PLAIN, 13));
|
164
|
185
|
cp.add(editG);
|
165
|
186
|
editG.addActionListener(new ActionListener() {
|
166
|
187
|
public void actionPerformed(ActionEvent evt) {
|
167
|
|
- editGActionPerformed(evt);
|
|
188
|
+ editG_ActionPerformed(evt);
|
168
|
189
|
}
|
169
|
190
|
});
|
170
|
191
|
|
171
|
192
|
editH.setBounds(264, 232, 107, 25);
|
172
|
193
|
editH.setText("Layer H");
|
|
194
|
+ editH.setFont(new Font("Dialog", Font.PLAIN, 13));
|
173
|
195
|
cp.add(editH);
|
174
|
196
|
editH.addActionListener(new ActionListener() {
|
175
|
197
|
public void actionPerformed(ActionEvent evt) {
|
176
|
|
- editHActionPerformed(evt);
|
|
198
|
+ editH_ActionPerformed(evt);
|
177
|
199
|
}
|
178
|
200
|
});
|
179
|
201
|
|
180
|
|
- frameList.setBounds(384, 8, 145, 249);
|
181
|
|
- cp.add(frameList);
|
|
202
|
+ frameListScrollPane.setBounds(384, 8, 145, 249);
|
|
203
|
+ frameList.setModel(frameListModel);
|
|
204
|
+ //frameListModel.addElement();
|
|
205
|
+ cp.add(frameListScrollPane);
|
182
|
206
|
frameUp.setBounds(544, 8, 107, 33);
|
183
|
207
|
frameUp.setText("Move up");
|
|
208
|
+ frameUp.setFont(new Font("Dialog", Font.PLAIN, 13));
|
184
|
209
|
cp.add(frameUp);
|
185
|
210
|
frameUp.addActionListener(new ActionListener() {
|
186
|
211
|
public void actionPerformed(ActionEvent evt) {
|
187
|
|
- frameUpActionPerformed(evt);
|
|
212
|
+ frameUp_ActionPerformed(evt);
|
188
|
213
|
}
|
189
|
214
|
});
|
190
|
215
|
|
191
|
216
|
frameDown.setBounds(544, 152, 107, 33);
|
192
|
217
|
frameDown.setText("Move down");
|
|
218
|
+ frameDown.setFont(new Font("Dialog", Font.PLAIN, 13));
|
193
|
219
|
cp.add(frameDown);
|
194
|
220
|
frameDown.addActionListener(new ActionListener() {
|
195
|
221
|
public void actionPerformed(ActionEvent evt) {
|
196
|
|
- frameDownActionPerformed(evt);
|
|
222
|
+ frameDown_ActionPerformed(evt);
|
197
|
223
|
}
|
198
|
224
|
});
|
199
|
225
|
|
200
|
226
|
frameAdd.setBounds(544, 56, 107, 33);
|
201
|
227
|
frameAdd.setText("Add");
|
|
228
|
+ frameAdd.setFont(new Font("Dialog", Font.PLAIN, 13));
|
202
|
229
|
cp.add(frameAdd);
|
203
|
230
|
frameAdd.addActionListener(new ActionListener() {
|
204
|
231
|
public void actionPerformed(ActionEvent evt) {
|
205
|
|
- frameAddActionPerformed(evt);
|
|
232
|
+ frameAdd_ActionPerformed(evt);
|
206
|
233
|
}
|
207
|
234
|
});
|
208
|
235
|
|
209
|
236
|
frameRemove.setBounds(544, 104, 107, 33);
|
210
|
237
|
frameRemove.setText("Remove");
|
|
238
|
+ frameRemove.setFont(new Font("Dialog", Font.PLAIN, 13));
|
211
|
239
|
cp.add(frameRemove);
|
212
|
240
|
frameRemove.addActionListener(new ActionListener() {
|
213
|
241
|
public void actionPerformed(ActionEvent evt) {
|
214
|
|
- frameRemoveActionPerformed(evt);
|
|
242
|
+ frameRemove_ActionPerformed(evt);
|
215
|
243
|
}
|
216
|
244
|
});
|
217
|
245
|
|
218
|
|
- jList2.setBounds(8, 264, 209, 121);
|
219
|
|
- cp.add(jList2);
|
|
246
|
+ jList2ScrollPane.setBounds(8, 264, 209, 121);
|
|
247
|
+ jList2.setModel(jList2Model);
|
|
248
|
+ //jList2Model.addElement("");
|
|
249
|
+ cp.add(jList2ScrollPane);
|
220
|
250
|
animUp.setBounds(224, 264, 99, 25);
|
221
|
251
|
animUp.setText("Move up");
|
|
252
|
+ animUp.setFont(new Font("Dialog", Font.PLAIN, 13));
|
222
|
253
|
cp.add(animUp);
|
223
|
254
|
animUp.addActionListener(new ActionListener() {
|
224
|
255
|
public void actionPerformed(ActionEvent evt) {
|
225
|
|
- animUpActionPerformed(evt);
|
|
256
|
+ animUp_ActionPerformed(evt);
|
226
|
257
|
}
|
227
|
258
|
});
|
228
|
259
|
|
229
|
260
|
animDown.setBounds(224, 360, 99, 25);
|
230
|
261
|
animDown.setText("Move down");
|
|
262
|
+ animDown.setFont(new Font("Dialog", Font.PLAIN, 13));
|
231
|
263
|
cp.add(animDown);
|
232
|
264
|
animDown.addActionListener(new ActionListener() {
|
233
|
265
|
public void actionPerformed(ActionEvent evt) {
|
234
|
|
- animDownActionPerformed(evt);
|
|
266
|
+ animDown_ActionPerformed(evt);
|
235
|
267
|
}
|
236
|
268
|
});
|
237
|
269
|
|
238
|
270
|
animAdd.setBounds(224, 296, 99, 25);
|
239
|
271
|
animAdd.setText("Add");
|
|
272
|
+ animAdd.setFont(new Font("Dialog", Font.PLAIN, 13));
|
240
|
273
|
cp.add(animAdd);
|
241
|
274
|
animAdd.addActionListener(new ActionListener() {
|
242
|
275
|
public void actionPerformed(ActionEvent evt) {
|
243
|
|
- animAddActionPerformed(evt);
|
|
276
|
+ animAdd_ActionPerformed(evt);
|
244
|
277
|
}
|
245
|
278
|
});
|
246
|
279
|
|
247
|
280
|
animRemove.setBounds(224, 328, 99, 25);
|
248
|
281
|
animRemove.setText("Remove");
|
|
282
|
+ animRemove.setFont(new Font("Dialog", Font.PLAIN, 13));
|
249
|
283
|
cp.add(animRemove);
|
250
|
284
|
animRemove.addActionListener(new ActionListener() {
|
251
|
285
|
public void actionPerformed(ActionEvent evt) {
|
252
|
|
- animRemoveActionPerformed(evt);
|
|
286
|
+ animRemove_ActionPerformed(evt);
|
253
|
287
|
}
|
254
|
288
|
});
|
255
|
289
|
|
256
|
290
|
animPath.setBounds(344, 264, 305, 24);
|
257
|
291
|
animPath.setEditable(false);
|
258
|
292
|
animPath.setText("Load/Save an animation file...");
|
|
293
|
+ animPath.setFont(new Font("Dialog", Font.PLAIN, 13));
|
259
|
294
|
cp.add(animPath);
|
260
|
295
|
load.setBounds(344, 296, 147, 25);
|
261
|
296
|
load.setText("Load");
|
|
297
|
+ load.setFont(new Font("Dialog", Font.PLAIN, 13));
|
262
|
298
|
cp.add(load);
|
263
|
299
|
load.addActionListener(new ActionListener() {
|
264
|
300
|
public void actionPerformed(ActionEvent evt) {
|
265
|
|
- loadActionPerformed(evt);
|
|
301
|
+ load_ActionPerformed(evt);
|
266
|
302
|
}
|
267
|
303
|
});
|
268
|
304
|
|
269
|
305
|
save.setBounds(504, 296, 147, 25);
|
270
|
306
|
save.setText("Save");
|
|
307
|
+ save.setFont(new Font("Dialog", Font.PLAIN, 13));
|
271
|
308
|
cp.add(save);
|
272
|
309
|
save.addActionListener(new ActionListener() {
|
273
|
310
|
public void actionPerformed(ActionEvent evt) {
|
274
|
|
- saveActionPerformed(evt);
|
|
311
|
+ save_ActionPerformed(evt);
|
275
|
312
|
}
|
276
|
313
|
});
|
277
|
314
|
|
278
|
315
|
jComboBox1.setBounds(344, 328, 305, 24);
|
|
316
|
+ jComboBox1.setFont(new Font("Dialog", Font.PLAIN, 13));
|
279
|
317
|
cp.add(jComboBox1);
|
280
|
318
|
upload.setBounds(344, 360, 147, 25);
|
281
|
319
|
upload.setText("Upload");
|
|
320
|
+ upload.setFont(new Font("Dialog", Font.PLAIN, 13));
|
282
|
321
|
cp.add(upload);
|
283
|
322
|
upload.addActionListener(new ActionListener() {
|
284
|
323
|
public void actionPerformed(ActionEvent evt) {
|
285
|
|
- uploadActionPerformed(evt);
|
|
324
|
+ upload_ActionPerformed(evt);
|
286
|
325
|
}
|
287
|
326
|
});
|
288
|
327
|
|
289
|
328
|
download.setBounds(504, 360, 147, 25);
|
290
|
329
|
download.setText("Download");
|
|
330
|
+ download.setFont(new Font("Dialog", Font.PLAIN, 13));
|
291
|
331
|
cp.add(download);
|
292
|
332
|
download.addActionListener(new ActionListener() {
|
293
|
333
|
public void actionPerformed(ActionEvent evt) {
|
294
|
|
- downloadActionPerformed(evt);
|
|
334
|
+ download_ActionPerformed(evt);
|
295
|
335
|
}
|
296
|
336
|
});
|
297
|
337
|
|
298
|
|
- jLabel4.setBounds(536, 208, 111, 16);
|
|
338
|
+ jLabel4.setBounds(536, 208, 112, 20);
|
299
|
339
|
jLabel4.setText("Frames remaining:");
|
300
|
|
- jLabel4.setFont(new Font("MS Sans Serif", Font.PLAIN, 13));
|
|
340
|
+ jLabel4.setFont(new Font("Dialog", Font.PLAIN, 13));
|
301
|
341
|
cp.add(jLabel4);
|
302
|
342
|
frameRemaining.setBounds(536, 232, 113, 24);
|
303
|
343
|
frameRemaining.setEditable(false);
|
304
|
344
|
frameRemaining.setText("2048");
|
|
345
|
+ frameRemaining.setFont(new Font("Dialog", Font.PLAIN, 13));
|
305
|
346
|
cp.add(frameRemaining);
|
|
347
|
+ jList2.setFont(new Font("Dialog", Font.PLAIN, 13));
|
|
348
|
+ frameList.setFont(new Font("Dialog", Font.PLAIN, 13));
|
306
|
349
|
// Ende Komponenten
|
307
|
350
|
|
308
|
351
|
setResizable(false);
|
309
|
352
|
setVisible(true);
|
310
|
353
|
}
|
311
|
354
|
|
|
355
|
+ // Anfang Methoden
|
|
356
|
+
|
312
|
357
|
// Anfang Ereignisprozeduren
|
313
|
|
- public void editAActionPerformed(ActionEvent evt) {
|
|
358
|
+ public void editA_ActionPerformed(ActionEvent evt) {
|
314
|
359
|
|
315
|
360
|
}
|
316
|
361
|
|
317
|
|
- public void editBActionPerformed(ActionEvent evt) {
|
|
362
|
+ public void editB_ActionPerformed(ActionEvent evt) {
|
318
|
363
|
|
319
|
364
|
}
|
320
|
365
|
|
321
|
|
- public void editCActionPerformed(ActionEvent evt) {
|
|
366
|
+ public void editC_ActionPerformed(ActionEvent evt) {
|
322
|
367
|
|
323
|
368
|
}
|
324
|
369
|
|
325
|
|
- public void editDActionPerformed(ActionEvent evt) {
|
|
370
|
+ public void editD_ActionPerformed(ActionEvent evt) {
|
326
|
371
|
|
327
|
372
|
}
|
328
|
373
|
|
329
|
|
- public void editEActionPerformed(ActionEvent evt) {
|
|
374
|
+ public void editE_ActionPerformed(ActionEvent evt) {
|
330
|
375
|
|
331
|
376
|
}
|
332
|
377
|
|
333
|
|
- public void editFActionPerformed(ActionEvent evt) {
|
|
378
|
+ public void editF_ActionPerformed(ActionEvent evt) {
|
334
|
379
|
|
335
|
380
|
}
|
336
|
381
|
|
337
|
|
- public void editGActionPerformed(ActionEvent evt) {
|
|
382
|
+ public void editG_ActionPerformed(ActionEvent evt) {
|
338
|
383
|
|
339
|
384
|
}
|
340
|
385
|
|
341
|
|
- public void editHActionPerformed(ActionEvent evt) {
|
|
386
|
+ public void editH_ActionPerformed(ActionEvent evt) {
|
342
|
387
|
|
343
|
388
|
}
|
344
|
389
|
|
345
|
|
- public void frameUpActionPerformed(ActionEvent evt) {
|
|
390
|
+ public void frameUp_ActionPerformed(ActionEvent evt) {
|
346
|
391
|
int i = frameList.getSelectedIndex();
|
347
|
392
|
if ((i > 0) && (frameListModel.getSize() >= 2)) {
|
348
|
393
|
Object tmp = frameListModel.get(i);
|
|
@@ -352,7 +397,7 @@ public class frame extends JFrame {
|
352
|
397
|
}
|
353
|
398
|
}
|
354
|
399
|
|
355
|
|
- public void frameDownActionPerformed(ActionEvent evt) {
|
|
400
|
+ public void frameDown_ActionPerformed(ActionEvent evt) {
|
356
|
401
|
int i = frameList.getSelectedIndex();
|
357
|
402
|
if ((i >= 0) && (frameListModel.getSize() >= 2) && (i < (frameListModel.getSize() - 1))) {
|
358
|
403
|
Object tmp = frameListModel.get(i);
|
|
@@ -362,62 +407,67 @@ public class frame extends JFrame {
|
362
|
407
|
}
|
363
|
408
|
}
|
364
|
409
|
|
365
|
|
- public void frameAddActionPerformed(ActionEvent evt) {
|
366
|
|
-
|
|
410
|
+ public void frameAdd_ActionPerformed(ActionEvent evt) {
|
|
411
|
+ worker.addFrame();
|
|
412
|
+ frameRemaining.setText(Integer.toString(worker.framesRemaining()));
|
367
|
413
|
}
|
368
|
414
|
|
369
|
|
- public void frameRemoveActionPerformed(ActionEvent evt) {
|
370
|
|
-
|
|
415
|
+ public void frameRemove_ActionPerformed(ActionEvent evt) {
|
|
416
|
+ worker.removeFrame(jList2.getSelectedIndex());
|
|
417
|
+ frameRemaining.setText(Integer.toString(worker.framesRemaining()));
|
371
|
418
|
}
|
372
|
419
|
|
373
|
|
- public void animUpActionPerformed(ActionEvent evt) {
|
|
420
|
+ public void animUp_ActionPerformed(ActionEvent evt) {
|
374
|
421
|
int i = jList2.getSelectedIndex();
|
375
|
|
- if ((i > 0) && (animationListModel.getSize() >= 2)) {
|
376
|
|
- Object tmp = animationListModel.get(i);
|
377
|
|
- animationListModel.set(i, animationListModel.get(i - 1));
|
378
|
|
- animationListModel.set(i - 1, tmp);
|
|
422
|
+ if ((i > 0) && (jList2Model.getSize() >= 2)) {
|
|
423
|
+ Object tmp = jList2Model.get(i);
|
|
424
|
+ jList2Model.set(i, jList2Model.get(i - 1));
|
|
425
|
+ jList2Model.set(i - 1, tmp);
|
379
|
426
|
jList2.setSelectedIndex(i - 1);
|
380
|
427
|
}
|
381
|
428
|
}
|
382
|
429
|
|
383
|
|
- public void animDownActionPerformed(ActionEvent evt) {
|
|
430
|
+ public void animDown_ActionPerformed(ActionEvent evt) {
|
384
|
431
|
int i = jList2.getSelectedIndex();
|
385
|
|
- if ((i >= 0) && (animationListModel.getSize() >= 2) && (i < (animationListModel.getSize() - 1))) {
|
386
|
|
- Object tmp = animationListModel.get(i);
|
387
|
|
- animationListModel.set(i, animationListModel.get(i + 1));
|
388
|
|
- animationListModel.set(i + 1, tmp);
|
|
432
|
+ if ((i >= 0) && (jList2Model.getSize() >= 2) && (i < (jList2Model.getSize() - 1))) {
|
|
433
|
+ Object tmp = jList2Model.get(i);
|
|
434
|
+ jList2Model.set(i, jList2Model.get(i + 1));
|
|
435
|
+ jList2Model.set(i + 1, tmp);
|
389
|
436
|
jList2.setSelectedIndex(i + 1);
|
390
|
437
|
}
|
391
|
438
|
}
|
392
|
439
|
|
393
|
|
- public void animAddActionPerformed(ActionEvent evt) {
|
|
440
|
+ public void animAdd_ActionPerformed(ActionEvent evt) {
|
|
441
|
+ if(worker.addAnimation() == -1){
|
|
442
|
+ //show error Dialog
|
|
443
|
+ }
|
394
|
444
|
|
395
|
445
|
}
|
396
|
446
|
|
397
|
|
- public void animRemoveActionPerformed(ActionEvent evt) {
|
398
|
|
-
|
|
447
|
+ public void animRemove_ActionPerformed(ActionEvent evt) {
|
|
448
|
+ worker.removeAnimation(jList2.getSelectedIndex());
|
399
|
449
|
}
|
400
|
450
|
|
401
|
|
- public void loadActionPerformed(ActionEvent evt) {
|
402
|
|
-
|
|
451
|
+ public void load_ActionPerformed(ActionEvent evt) {
|
|
452
|
+ worker.loadState(animPath.getText());
|
403
|
453
|
}
|
404
|
454
|
|
405
|
|
- public void saveActionPerformed(ActionEvent evt) {
|
406
|
|
-
|
|
455
|
+ public void save_ActionPerformed(ActionEvent evt) {
|
|
456
|
+ worker.saveState(animPath.getText());
|
407
|
457
|
}
|
408
|
458
|
|
409
|
459
|
|
410
|
|
- public void uploadActionPerformed(ActionEvent evt) {
|
|
460
|
+ public void upload_ActionPerformed(ActionEvent evt) {
|
411
|
461
|
if (jComboBox1.getSelectedItem().equals("Select serial port...")) {
|
412
|
|
- JOptionPane.showMessageDialog(this, "No serial port selected...");
|
|
462
|
+ errorMessage("No serial port selected...");
|
413
|
463
|
} else {
|
414
|
464
|
worker.uploadState((String)jComboBox1.getSelectedItem());
|
415
|
465
|
}
|
416
|
466
|
}
|
417
|
467
|
|
418
|
|
- public void downloadActionPerformed(ActionEvent evt) {
|
|
468
|
+ public void download_ActionPerformed(ActionEvent evt) {
|
419
|
469
|
if (jComboBox1.getSelectedItem().equals("Select serial port...")) {
|
420
|
|
- JOptionPane.showMessageDialog(this, "No serial port selected...");
|
|
470
|
+ errorMessage("No serial port selected...");
|
421
|
471
|
} else {
|
422
|
472
|
worker.downloadState((String)jComboBox1.getSelectedItem());
|
423
|
473
|
}
|
|
@@ -428,5 +478,6 @@ public class frame extends JFrame {
|
428
|
478
|
public static void main(String[] args) {
|
429
|
479
|
new frame("Cube Control");
|
430
|
480
|
}
|
|
481
|
+ // Ende Methoden
|
431
|
482
|
}
|
432
|
483
|
|