Browse Source

Now shows success message after up-/download.

Thomas Buck 12 years ago
parent
commit
840611e983
1 changed files with 17 additions and 2 deletions
  1. 17
    2
      CubeControl/Frame.java

+ 17
- 2
CubeControl/Frame.java View File

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
 	 * Show an error message to the user via the most recent Frame.
169
 	 * Show an error message to the user via the most recent Frame.
159
 	 * @param s Error Message
170
 	 * @param s Error Message
160
 	 */
171
 	 */
756
 			public void actionPerformed(ActionEvent evt) {
767
 			public void actionPerformed(ActionEvent evt) {
757
 				// Error messages are generated by worker
768
 				// Error messages are generated by worker
758
 				if (worker.cubeProbeConnected((String) serialPortSelector.getSelectedItem())) {
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
 			public void actionPerformed(ActionEvent evt) {
781
 			public void actionPerformed(ActionEvent evt) {
769
 				// Error messages are generated by worker
782
 				// Error messages are generated by worker
770
 				if (worker.cubeProbeConnected((String) serialPortSelector.getSelectedItem())) {
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
 		});

Loading…
Cancel
Save