|
@@ -1,6 +1,7 @@
|
1
|
1
|
import java.awt.*;
|
2
|
2
|
import java.awt.event.*;
|
3
|
3
|
import javax.swing.*;
|
|
4
|
+import javax.swing.event.*;
|
4
|
5
|
|
5
|
6
|
/*
|
6
|
7
|
* frame.java
|
|
@@ -77,8 +78,8 @@ public class frame extends JFrame {
|
77
|
78
|
}
|
78
|
79
|
|
79
|
80
|
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]);
|
|
81
|
+ String[] Optionen = {"OK"};
|
|
82
|
+ JOptionPane.showOptionDialog(this, s, "Error!", JOptionPane.YES_OPTION, JOptionPane.ERROR_MESSAGE, null, Optionen, Optionen[0]);
|
82
|
83
|
}
|
83
|
84
|
|
84
|
85
|
public frame(String title) {
|
|
@@ -347,7 +348,7 @@ public class frame extends JFrame {
|
347
|
348
|
jList2.setFont(new Font("Dialog", Font.PLAIN, 13));
|
348
|
349
|
frameList.setFont(new Font("Dialog", Font.PLAIN, 13));
|
349
|
350
|
// Ende Komponenten
|
350
|
|
-
|
|
351
|
+ jList2.addListSelectionListener(new MyListSelectionListener(jList2, worker));
|
351
|
352
|
setResizable(false);
|
352
|
353
|
setVisible(true);
|
353
|
354
|
}
|
|
@@ -467,7 +468,7 @@ public class frame extends JFrame {
|
467
|
468
|
|
468
|
469
|
public void download_ActionPerformed(ActionEvent evt) {
|
469
|
470
|
if (jComboBox1.getSelectedItem().equals("Select serial port...")) {
|
470
|
|
- errorMessage("No serial port selected...");
|
|
471
|
+ errorMessage("No serial port selected...");
|
471
|
472
|
} else {
|
472
|
473
|
worker.downloadState((String)jComboBox1.getSelectedItem());
|
473
|
474
|
}
|
|
@@ -481,3 +482,18 @@ public class frame extends JFrame {
|
481
|
482
|
// Ende Methoden
|
482
|
483
|
}
|
483
|
484
|
|
|
485
|
+class MyListSelectionListener implements ListSelectionListener {
|
|
486
|
+
|
|
487
|
+ JList alist;
|
|
488
|
+ cubeWorker worker;
|
|
489
|
+ MyListSelectionListener(JList animList, cubeWorker w){
|
|
490
|
+ alist = animList;
|
|
491
|
+ worker = w;
|
|
492
|
+ }
|
|
493
|
+ public void valueChanged(ListSelectionEvent evt) {
|
|
494
|
+ if (!evt.getValueIsAdjusting()) {
|
|
495
|
+ worker.selectAnimation(alist.getSelectedIndex());
|
|
496
|
+ }
|
|
497
|
+ }
|
|
498
|
+}
|
|
499
|
+
|