|
@@ -155,6 +155,17 @@ public class Frame extends JFrame implements ListSelectionListener, ChangeListen
|
155
|
155
|
}
|
156
|
156
|
|
157
|
157
|
/**
|
|
158
|
+ * Show a dialog message to the user via this Frame.
|
|
159
|
+ * @param title Title of message box
|
|
160
|
+ * @param msg Error message.
|
|
161
|
+ */
|
|
162
|
+ public void showDialog(String title, String msg) {
|
|
163
|
+ String[] Optionen = { "OK" };
|
|
164
|
+ JOptionPane.showOptionDialog(this, msg, title, JOptionPane.YES_OPTION,
|
|
165
|
+ JOptionPane.INFORMATION_MESSAGE , null, Optionen, Optionen[0]);
|
|
166
|
+ }
|
|
167
|
+
|
|
168
|
+ /**
|
158
|
169
|
* Show an error message to the user via the most recent Frame.
|
159
|
170
|
* @param s Error Message
|
160
|
171
|
*/
|
|
@@ -756,7 +767,9 @@ public class Frame extends JFrame implements ListSelectionListener, ChangeListen
|
756
|
767
|
public void actionPerformed(ActionEvent evt) {
|
757
|
768
|
// Error messages are generated by worker
|
758
|
769
|
if (worker.cubeProbeConnected((String) serialPortSelector.getSelectedItem())) {
|
759
|
|
- worker.cubeSendState((String) serialPortSelector.getSelectedItem());
|
|
770
|
+ if (worker.cubeSendState((String) serialPortSelector.getSelectedItem()) == -1) {
|
|
771
|
+ showDialog("Success!", "Data was sent successfuly!");
|
|
772
|
+ }
|
760
|
773
|
}
|
761
|
774
|
}
|
762
|
775
|
});
|
|
@@ -768,7 +781,9 @@ public class Frame extends JFrame implements ListSelectionListener, ChangeListen
|
768
|
781
|
public void actionPerformed(ActionEvent evt) {
|
769
|
782
|
// Error messages are generated by worker
|
770
|
783
|
if (worker.cubeProbeConnected((String) serialPortSelector.getSelectedItem())) {
|
771
|
|
- worker.cubeGetState((String) serialPortSelector.getSelectedItem());
|
|
784
|
+ if (worker.cubeGetState((String) serialPortSelector.getSelectedItem()) == -1) {
|
|
785
|
+ showDialog("Success!", "Got data successfuly!");
|
|
786
|
+ }
|
772
|
787
|
}
|
773
|
788
|
}
|
774
|
789
|
});
|