|
@@ -72,8 +72,8 @@ public class Frame extends JFrame implements ListSelectionListener {
|
72
|
72
|
private JButton download = new JButton();
|
73
|
73
|
private JLabel jLabel4 = new JLabel();
|
74
|
74
|
private JTextField frameRemaining = new JTextField();
|
75
|
|
- private JLabel frmLngthLbl = new JLabel();
|
76
|
|
- private JTextField frmLngthTxt = new JTextField();
|
|
75
|
+ private JLabel frameLengthLabel = new JLabel();
|
|
76
|
+ private JTextField frameLengthText = new JTextField();
|
77
|
77
|
private JButton frameDuration = new JButton();
|
78
|
78
|
// Ende Attribute
|
79
|
79
|
|
|
@@ -107,10 +107,10 @@ public class Frame extends JFrame implements ListSelectionListener {
|
107
|
107
|
// If both selections are valid, update Frame duration and set 3D data
|
108
|
108
|
if ((animList.getSelectedIndex() != -1) && (frameList.getSelectedIndex() != -1)) {
|
109
|
109
|
ledView.setData(worker.getFrame(animList.getSelectedIndex(), frameList.getSelectedIndex()));
|
110
|
|
- frmLngthTxt.setText(Integer.toString(worker.getFrameTime(animList.getSelectedIndex(), frameList.getSelectedIndex())));
|
|
110
|
+ frameLengthText.setText(Integer.toString(worker.getFrameTime(animList.getSelectedIndex(), frameList.getSelectedIndex())));
|
111
|
111
|
} else {
|
112
|
112
|
// clear Frame duration
|
113
|
|
- frmLngthTxt.setText("");
|
|
113
|
+ frameLengthText.setText("");
|
114
|
114
|
}
|
115
|
115
|
|
116
|
116
|
if ((evt.getSource() == animList) && (animList.getSelectedIndex() != -1)) {
|
|
@@ -142,6 +142,7 @@ public class Frame extends JFrame implements ListSelectionListener {
|
142
|
142
|
public Frame(String title) {
|
143
|
143
|
// Frame-Initialisierung
|
144
|
144
|
super(title);
|
|
145
|
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
145
|
146
|
|
146
|
147
|
String[] sPorts = worker.getSerialPorts();
|
147
|
148
|
for(int i = 0; i < sPorts.length; i++){
|
|
@@ -328,15 +329,15 @@ public class Frame extends JFrame implements ListSelectionListener {
|
328
|
329
|
}
|
329
|
330
|
});
|
330
|
331
|
|
331
|
|
- frmLngthLbl.setBounds(536, 160, 113, 24);
|
332
|
|
- frmLngthLbl.setText("Time (1/24 sec)");
|
333
|
|
- frmLngthLbl.setFont(new Font("Dialog", Font.PLAIN, 13));
|
334
|
|
- cp.add(frmLngthLbl);
|
|
332
|
+ frameLengthLabel.setBounds(536, 160, 113, 24);
|
|
333
|
+ frameLengthLabel.setText("Time (1/24 sec)");
|
|
334
|
+ frameLengthLabel.setFont(new Font("Dialog", Font.PLAIN, 13));
|
|
335
|
+ cp.add(frameLengthLabel);
|
335
|
336
|
|
336
|
|
- frmLngthTxt.setBounds(536, 184, 50, 24);
|
337
|
|
- frmLngthTxt.setText("");
|
338
|
|
- frmLngthTxt.setFont(new Font("Dialog", Font.PLAIN, 13));
|
339
|
|
- cp.add(frmLngthTxt);
|
|
337
|
+ frameLengthText.setBounds(536, 184, 50, 24);
|
|
338
|
+ frameLengthText.setText("");
|
|
339
|
+ frameLengthText.setFont(new Font("Dialog", Font.PLAIN, 13));
|
|
340
|
+ cp.add(frameLengthText);
|
340
|
341
|
|
341
|
342
|
frameDuration.setBounds(590, 184, 50, 24);
|
342
|
343
|
frameDuration.setText("OK");
|
|
@@ -344,12 +345,12 @@ public class Frame extends JFrame implements ListSelectionListener {
|
344
|
345
|
cp.add(frameDuration);
|
345
|
346
|
frameDuration.addActionListener(new ActionListener() {
|
346
|
347
|
public void actionPerformed(ActionEvent evt) {
|
347
|
|
- if (frmLngthTxt.getText().equals("0")) {
|
|
348
|
+ if (frameLengthText.getText().equals("0")) {
|
348
|
349
|
errorMessage("0 is not a valid value!");
|
349
|
|
- frmLngthTxt.setText("1");
|
350
|
|
- } else if (Integer.parseInt(frmLngthTxt.getText()) > 256) {
|
|
350
|
+ frameLengthText.setText("1");
|
|
351
|
+ } else if (Integer.parseInt(frameLengthText.getText()) > 256) {
|
351
|
352
|
errorMessage("Value too high. Max: 256");
|
352
|
|
- frmLngthTxt.setText("256");
|
|
353
|
+ frameLengthText.setText("256");
|
353
|
354
|
return;
|
354
|
355
|
} else {
|
355
|
356
|
if (animList.getSelectedIndex() == -1) {
|
|
@@ -360,7 +361,7 @@ public class Frame extends JFrame implements ListSelectionListener {
|
360
|
361
|
errorMessage("Please select a Frame!");
|
361
|
362
|
return;
|
362
|
363
|
}
|
363
|
|
- worker.setFrameTime((byte)(Integer.parseInt(frmLngthTxt.getText()) - 1), animList.getSelectedIndex(), frameList.getSelectedIndex());
|
|
364
|
+ worker.setFrameTime((byte)(Integer.parseInt(frameLengthText.getText()) - 1), animList.getSelectedIndex(), frameList.getSelectedIndex());
|
364
|
365
|
}
|
365
|
366
|
}
|
366
|
367
|
});
|
|
@@ -742,13 +743,13 @@ public class Frame extends JFrame implements ListSelectionListener {
|
742
|
743
|
if (jComboBox1.getSelectedItem().equals("Select serial port...")) {
|
743
|
744
|
errorMessage("No serial port selected...");
|
744
|
745
|
} else {
|
745
|
|
- if (worker.probeCubeConnected((String)jComboBox1.getSelectedItem())) {
|
746
|
|
- if (worker.uploadState((String)jComboBox1.getSelectedItem()) != 0) {
|
747
|
|
- errorMessage("Could not upload data!");
|
748
|
|
- }
|
749
|
|
- } else {
|
750
|
|
- errorMessage("Cube does not respond...");
|
751
|
|
- }
|
|
746
|
+ if (worker.probeCubeConnected((String)jComboBox1.getSelectedItem())) {
|
|
747
|
+ if (worker.uploadState((String)jComboBox1.getSelectedItem()) != 0) {
|
|
748
|
+ errorMessage("Could not upload data!");
|
|
749
|
+ }
|
|
750
|
+ } else {
|
|
751
|
+ errorMessage("Cube does not respond...");
|
|
752
|
+ }
|
752
|
753
|
}
|
753
|
754
|
}
|
754
|
755
|
|
|
@@ -800,26 +801,26 @@ public class Frame extends JFrame implements ListSelectionListener {
|
800
|
801
|
System.out.println("All LEDs off now...");
|
801
|
802
|
}
|
802
|
803
|
|
803
|
|
- if (s.equals("e") || s.equals("exec")) {
|
804
|
|
- System.out.println(HelperUtility.runHelper(new String[0]));
|
805
|
|
- }
|
|
804
|
+ if (s.equals("e") || s.equals("exec")) {
|
|
805
|
+ System.out.println(HelperUtility.runHelper(new String[0]));
|
|
806
|
+ }
|
806
|
807
|
|
807
|
|
- if (s.startsWith("e ") || s.startsWith("exec ")) {
|
808
|
|
- int pos = 0;
|
809
|
|
- while (s.charAt(pos) != ' ') {
|
810
|
|
- pos++;
|
811
|
|
- }
|
812
|
|
- String[] arr = new String[1];
|
813
|
|
- arr[0] = s.substring(pos + 1);
|
814
|
|
- System.out.println(HelperUtility.runHelper(arr));
|
815
|
|
- }
|
|
808
|
+ if (s.startsWith("e ") || s.startsWith("exec ")) {
|
|
809
|
+ int pos = 0;
|
|
810
|
+ while (s.charAt(pos) != ' ') {
|
|
811
|
+ pos++;
|
|
812
|
+ }
|
|
813
|
+ String[] arr = new String[1];
|
|
814
|
+ arr[0] = s.substring(pos + 1);
|
|
815
|
+ System.out.println(HelperUtility.runHelper(arr));
|
|
816
|
+ }
|
816
|
817
|
|
817
|
818
|
if (s.equals("h") || (s.equals("help"))) {
|
818
|
819
|
System.out.println("Commands:");
|
819
|
820
|
System.out.println("\t'on' / '1'\t:\tToggle all LEDs on");
|
820
|
821
|
System.out.println("\t'off' / '0'\t:\tToggle all LEDs off");
|
821
|
822
|
System.out.println("\t'print' / 'p'\t:\tPrint 3D Translation Matrix Data");
|
822
|
|
- System.out.println("\t'exec' / 'e'\t:\tExecute helper with given args");
|
|
823
|
+ System.out.println("\t'exec' / 'e'\t:\tExecute helper with given args");
|
823
|
824
|
System.out.println("\t'help' / 'h'\t:\tShow this message");
|
824
|
825
|
System.out.println("\t'quit' / 'q'\t:\tExit Cube Control");
|
825
|
826
|
}
|