/*
2 * PositionDialog.java
3 *
4 * Copyright (c) 2003, Raben Systems, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * Neither the name of Raben Systems, Inc. nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 package com.raben.telescope.comm;
35 import java.util.TimerTask;
36 import java.util.Timer;
37 import java.util.Properties;
38 import java.util.ResourceBundle;
39 import java.util.TimeZone;
40 import java.util.Calendar;
41 import java.util.GregorianCalendar;
42 import java.awt.EventQueue;
43 import java.awt.geom.Point2D;
44 import java.io.IOException;
45 import java.text.MessageFormat;
46 import java.text.DateFormat;
47
48
49 /***
50 *
51 * Display telescope position as local horizontal coordinates and equatorial and
52 * GPS date/time and geographic coordinate
53 * coordinates
54 * @author Vern Raben
55 * @version $Revision: 1.1.1.1 $ $Date: 2003/06/13 04:51:05 $
56 */
57 public class PositionDialog extends javax.swing.JDialog {
58
59 /*** Creates new formPositionDialog
60 * @param parent Reference to parent frame
61 * @param telescope The telescope interface
62 */
63 public PositionDialog(java.awt.Frame parent, TelescopeInterface telescope) {
64 super(parent, false);
65 this.telescope = telescope;
66 initComponents();
67 dateTimeFormat.setTimeZone(TZ);
68
69 // Set connect toggle to current state
70 if (telescope != null) {
71 connectToggle.setSelected(telescope.isConnected());
72 }
73
74 startTelescopeUpdate();
75 }
76
77 /*** This method is called from within the constructor to
78 * initialize the form.
79 * WARNING: Do NOT modify this code. The content of this method is
80 * always regenerated by the Form Editor.
81 */
82 private void initComponents() {//GEN-BEGIN:initComponents
83 jPanel3 = new javax.swing.JPanel();
84 jPanel4 = new javax.swing.JPanel();
85 jLabel5 = new javax.swing.JLabel();
86 gpsDateTimeTextField = new javax.swing.JTextField();
87 jPanel41 = new javax.swing.JPanel();
88 jLabel51 = new javax.swing.JLabel();
89 gpsLongitudeTextField = new javax.swing.JTextField();
90 jLabel511 = new javax.swing.JLabel();
91 gpsLatitudeTextfield = new javax.swing.JTextField();
92 jPanel5 = new javax.swing.JPanel();
93 jPanel6 = new javax.swing.JPanel();
94 jLabel6 = new javax.swing.JLabel();
95 raTextField = new javax.swing.JTextField();
96 jLabel61 = new javax.swing.JLabel();
97 decTextField = new javax.swing.JTextField();
98 jPanel61 = new javax.swing.JPanel();
99 jLabel62 = new javax.swing.JLabel();
100 azmTextField = new javax.swing.JTextField();
101 jLabel611 = new javax.swing.JLabel();
102 altTextField = new javax.swing.JTextField();
103 jPanel8 = new javax.swing.JPanel();
104 cancelButton = new javax.swing.JButton();
105 connectToggle = new javax.swing.JToggleButton();
106
107 getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS));
108
109 setTitle(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("TELESCOPE_POSITION"));
110 addWindowListener(new java.awt.event.WindowAdapter() {
111 public void windowClosing(java.awt.event.WindowEvent evt) {
112 closeDialog(evt);
113 }
114 });
115
116 jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.Y_AXIS));
117
118 jPanel3.setBorder(new javax.swing.border.TitledBorder(null, java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("GPS"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 11), new java.awt.Color(0, 0, 0)));
119 jPanel4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
120
121 jLabel5.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("DATE_TIME"));
122 jPanel4.add(jLabel5);
123
124 gpsDateTimeTextField.setColumns(18);
125 gpsDateTimeTextField.setEditable(false);
126 gpsDateTimeTextField.setEnabled(false);
127 jPanel4.add(gpsDateTimeTextField);
128
129 jPanel3.add(jPanel4);
130
131 jPanel41.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
132
133 jLabel51.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("LONGITUDE"));
134 jPanel41.add(jLabel51);
135
136 gpsLongitudeTextField.setColumns(10);
137 gpsLongitudeTextField.setEditable(false);
138 gpsLongitudeTextField.setEnabled(false);
139 jPanel41.add(gpsLongitudeTextField);
140
141 jLabel511.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("LATITUDE"));
142 jPanel41.add(jLabel511);
143
144 gpsLatitudeTextfield.setColumns(10);
145 gpsLatitudeTextfield.setEditable(false);
146 gpsLatitudeTextfield.setEnabled(false);
147 jPanel41.add(gpsLatitudeTextfield);
148
149 jPanel3.add(jPanel41);
150
151 getContentPane().add(jPanel3);
152
153 jPanel5.setLayout(new javax.swing.BoxLayout(jPanel5, javax.swing.BoxLayout.Y_AXIS));
154
155 jPanel5.setBorder(new javax.swing.border.TitledBorder(null, java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("TELESCOPE_POSITION"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 11), new java.awt.Color(0, 0, 0)));
156 jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
157
158 jPanel6.setBackground(new java.awt.Color(204, 204, 204));
159 jLabel6.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("RA"));
160 jLabel6.setLabelFor(raTextField);
161 jPanel6.add(jLabel6);
162
163 raTextField.setColumns(10);
164 raTextField.setEditable(false);
165 raTextField.setEnabled(false);
166 jPanel6.add(raTextField);
167
168 jLabel61.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("DEC"));
169 jPanel6.add(jLabel61);
170
171 decTextField.setColumns(10);
172 decTextField.setEditable(false);
173 decTextField.setEnabled(false);
174 jPanel6.add(decTextField);
175
176 jPanel5.add(jPanel6);
177
178 jPanel61.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
179
180 jLabel62.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("AZM"));
181 jPanel61.add(jLabel62);
182
183 azmTextField.setColumns(9);
184 azmTextField.setEditable(false);
185 azmTextField.setEnabled(false);
186 jPanel61.add(azmTextField);
187
188 jLabel611.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("ALT"));
189 jPanel61.add(jLabel611);
190
191 altTextField.setColumns(9);
192 altTextField.setEditable(false);
193 altTextField.setEnabled(false);
194 jPanel61.add(altTextField);
195
196 jPanel5.add(jPanel61);
197
198 getContentPane().add(jPanel5);
199
200 jPanel8.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
201
202 cancelButton.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("CANCEL"));
203 cancelButton.addActionListener(new java.awt.event.ActionListener() {
204 public void actionPerformed(java.awt.event.ActionEvent evt) {
205 cancelButtonActionPerformed(evt);
206 }
207 });
208
209 jPanel8.add(cancelButton);
210
211 connectToggle.setText(java.util.ResourceBundle.getBundle("resources/comm/Telescope").getString("CONNECT"));
212 connectToggle.setMargin(new java.awt.Insets(2, 2, 2, 2));
213 connectToggle.addActionListener(new java.awt.event.ActionListener() {
214 public void actionPerformed(java.awt.event.ActionEvent evt) {
215 connectToggleActionPerformed(evt);
216 }
217 });
218
219 jPanel8.add(connectToggle);
220
221 getContentPane().add(jPanel8);
222
223 pack();
224 }//GEN-END:initComponents
225
226 /***
227 * Handle cancel button being pressed
228 * @param evt Not used
229 */
230 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
231 closeDialog(null);
232 }//GEN-LAST:event_cancelButtonActionPerformed
233
234 /*** Handle connection toggle button being pressed
235 * @param evt Not used
236 */
237 private void connectToggleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectToggleActionPerformed
238 if (connectToggle.isSelected()) {
239 if (showSolarHazardWarning()) {
240 try {
241 if (telescope != null) {
242 telescope.connect();
243 startTelescopeUpdate();
244 }
245 } catch (IOException e) {
246
247 // Show connect error dialog
248 System.out.println(e);
249 }
250 }
251
252
253 } else {
254 stopTelescopeUpdate();
255 telescope.close();
256 connectToggle.setSelected(telescope.isConnected());
257
258 }
259 }//GEN-LAST:event_connectToggleActionPerformed
260
261 /*** Closes the dialog
262 * @param evt (Not used)
263 */
264 private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
265 setVisible(false);
266 dispose();
267 stopTelescopeUpdate();
268
269 if (isStandalone()) {
270 System.exit(0);
271 }
272 }//GEN-LAST:event_closeDialog
273
274 /***
275 * Called when PositionDialog run as standalone program
276 * @param args the command line arguments
277 */
278 public static void main(String args[]) {
279
280 TelescopeInterface telescope = TelescopeFactory.newInstance();
281 PositionDialog positionDialog =
282 new PositionDialog(new javax.swing.JFrame(), telescope);
283 positionDialog.setStandalone(true);
284 positionDialog.show();
285 }
286
287
288 /***
289 * Cancel telescope update info and display tasks and timers
290 */
291 private void stopTelescopeUpdate() {
292 if (telescopeInfoTask != null) {
293 telescopeInfoTask.cancel();
294 telescopeInfoTask = null;
295 }
296
297 if (telescopeInfoTimer != null) {
298 telescopeInfoTimer.cancel();
299 telescopeInfoTimer = null;
300 }
301
302 if (updateDisplayTask != null) {
303 updateDisplayTask.cancel();
304 updateDisplayTask = null;
305 }
306
307 if (updateDisplayTimer != null) {
308 updateDisplayTimer.cancel();
309 updateDisplayTimer = null;
310 }
311 }
312
313 /***
314 * Start update info and display timers and tasks
315 */
316 private void startTelescopeUpdate() {
317 if ((telescope != null) && (telescope.isConnected())) {
318 stopTelescopeUpdate();
319 updateDisplayTask = new UpdateDisplayTask();
320 updateDisplayTimer = new Timer(true);
321 updateDisplayTimer.schedule(updateDisplayTask, 4000L,
322 updateDisplayInterval);
323 telescopeInfoTask = new TelescopeInfoTask();
324 telescopeInfoTimer = new Timer(true);
325 telescopeInfoTimer.schedule(telescopeInfoTask, 200L,
326 telescopeInfoInterval);
327
328 }
329 }
330
331 /***
332 * Display solar hazard warning dialog
333 * @return true if user acknowledges solar hazard
334 */
335 private boolean showSolarHazardWarning() {
336 if (!solarHazardDialog.isAccepted()) {
337 solarHazardDialog.show();
338 connectToggle.setSelected(solarHazardDialog.isAccepted());
339 }
340
341 return solarHazardDialog.isAccepted();
342 }
343
344 /*** Getter for property standalone.
345 * @return Value of property standalone.
346 */
347 public boolean isStandalone() {
348 return this.standalone;
349 }
350
351 /*** Setter for property standalone.
352 * @param standalone New value of property standalone.
353 */
354 public void setStandalone(boolean standalone) {
355 this.standalone = standalone;
356 }
357
358 /***
359 * Get angle as Integer array containg degrees, minues, and seconds
360 * @param angle Angle in degrees
361 * @return An int array containing degres, minutes, and seconds
362 */
363 private Integer[] getDegreesMinutesSeconds(double angle) {
364 Integer[] dms = new Integer[3];
365 dms[0] = new Integer((int) angle);
366 double dmin = 60.0 * (Math.abs(angle) - Math.abs(dms[0].intValue()));
367 dms[1] = new Integer((int) dmin);
368 double dsec = 60.0 * (dmin - dms[1].intValue());
369 dms[2] = new Integer((int) Math.round(dsec));
370 return dms;
371 }
372
373 // Variables declaration - do not modify//GEN-BEGIN:variables
374 private javax.swing.JPanel jPanel8;
375 private javax.swing.JPanel jPanel6;
376 private javax.swing.JPanel jPanel5;
377 private javax.swing.JPanel jPanel4;
378 private javax.swing.JPanel jPanel3;
379 private javax.swing.JPanel jPanel41;
380 private javax.swing.JPanel jPanel61;
381 private javax.swing.JLabel jLabel611;
382 private javax.swing.JTextField decTextField;
383 private javax.swing.JLabel jLabel511;
384 private javax.swing.JTextField gpsLongitudeTextField;
385 private javax.swing.JTextField gpsDateTimeTextField;
386 private javax.swing.JLabel jLabel62;
387 private javax.swing.JLabel jLabel61;
388 private javax.swing.JTextField altTextField;
389 private javax.swing.JToggleButton connectToggle;
390 private javax.swing.JTextField raTextField;
391 private javax.swing.JTextField azmTextField;
392 private javax.swing.JTextField gpsLatitudeTextfield;
393 private javax.swing.JButton cancelButton;
394 private javax.swing.JLabel jLabel6;
395 private javax.swing.JLabel jLabel5;
396 private javax.swing.JLabel jLabel51;
397 // End of variables declaration//GEN-END:variables
398
399 /*** Timer to periodically run DisplayUpdateTask */
400 private Timer updateDisplayTimer = null;
401
402 /*** Task to update telescope status display */
403 private UpdateDisplayTask updateDisplayTask = null;
404
405 /*** Telescope display update interval */
406 private long updateDisplayInterval = 2000L;
407
408 /*** Timer to periodically run TelescopeInfoTask */
409 private Timer telescopeInfoTimer = null;
410
411 /*** Task to retrieve info from telescope */
412 private TelescopeInfoTask telescopeInfoTask = null;
413
414 /*** Telescope information interval */
415 private long telescopeInfoInterval = 4000L;
416
417 /*** Telescope interface */
418 private TelescopeInterface telescope = null;
419
420
421 /*** Telescope properties */
422 private Properties telescopeProperties = new Properties();
423
424 /*** Holds value of property standalone. */
425 private boolean standalone;
426
427 /*** MessageFormat for degrees/minutes/seconds */
428 private MessageFormat dmsFmt = new MessageFormat(
429 ResourceBundle.getBundle("resources/comm/Telescope").getString(
430 "DMS_FORMAT"));
431
432 /*** MessageFormat for hours/minutes/seconds */
433 private MessageFormat hmsFmt = new MessageFormat(
434 ResourceBundle.getBundle("resources/comm/Telescope").getString(
435 "HMS_FORMAT"));
436 /*** Time zone for UTC */
437 private static final TimeZone TZ = TimeZone.getTimeZone("UTC");
438
439 /*** Date/Time Format */
440 private DateFormat dateTimeFormat
441 = DateFormat.getDateTimeInstance();
442
443 /*** Local horizontal coordinate */
444 private Point2D horizCoord = new Point2D.Double(0.0, 0.0);
445
446 /*** Equatorial coordinate */
447 private Point2D eqCoord = new Point2D.Double(0.0, 0.0);
448
449 /*** GSP geographic coordinate */
450 private Point2D gpsCoordinate = new Point2D.Double(0.0, 0.0);
451
452 /*** Flag that indicates whether or not scope is aligned */
453 private boolean aligned = false;
454
455 /*** Flag that indicates whether or not scope is communicating */
456 private boolean communicating = false;
457
458 /*** Flag that indicates whether or not GPS is linked */
459 private boolean gpsLinked = false;
460 /*** GPS Date/Time */
461 private Calendar gpsDateTime = GregorianCalendar.getInstance(TZ);
462 /*** Define longest time that task can be late */
463 private static final long MAX_TARDINESS = 2000L;
464
465 /*** Dialog showing solar hazard warning */
466 private SolarHazardDialog solarHazardDialog
467 = new SolarHazardDialog(null, true);
468
469 /*** Inner class to retrieve information from telescope */
470 class TelescopeInfoTask extends TimerTask {
471 /*** Flag to indicate ok to keep getting info */
472 private boolean ok = true;
473
474 /*** Counter to check status */
475 private int checkCount = 0;
476
477 /*** Called when task is scheduled */
478 public void run() {
479 try {
480 if (System.currentTimeMillis() - scheduledExecutionTime() >=
481 MAX_TARDINESS) {
482 return; // Too late; skip this execution.
483 }
484
485 if ((ok) && (!communicating)) {
486 communicating = telescope.isCommunicating();
487 }
488
489 if ((ok) && (communicating) && (!aligned)) {
490 aligned = telescope.isAligned();
491 gpsLinked = telescope.isGpsLinked();
492 }
493
494 if ((ok) && (aligned)) {
495 synchronized (horizCoord) {
496 horizCoord.setLocation(telescope.getAzimuthAltitude());
497 }
498
499 synchronized (eqCoord) {
500 eqCoord.setLocation(telescope.getRightAscensionDeclination());
501 }
502 }
503
504 if ((ok) && (gpsLinked) && (communicating)) {
505 Calendar cal = telescope.getGpsDateTime();
506
507 synchronized (gpsDateTime) {
508 gpsDateTime.setTime(cal.getTime());
509 }
510
511 synchronized (gpsCoordinate) {
512 gpsCoordinate.setLocation(telescope.getGpsCoordinate());
513 }
514 }
515
516 // Periodically check communications and gps
517 if (ok) {
518 checkCount++;
519
520 if (checkCount > 5) {
521 checkCount = 0;
522 gpsLinked = telescope.isGpsLinked();
523 }
524 }
525
526 } catch (IOException e) {
527 System.out.println(e);
528 }
529 }
530
531 /*** Cancel task
532 @return True when canceled
533 */
534 public boolean cancel() {
535 ok = false;
536 return super.cancel();
537 }
538
539 }
540
541 /*** Inner class to update the display */
542 class UpdateDisplayTask extends TimerTask {
543 /*** Flag to control whether its ok to continue update */
544 private boolean ok = true;
545
546 /*** Called when timer starts task */
547 public void run() {
548 if (!EventQueue.isDispatchThread()) {
549 EventQueue.invokeLater(this);
550 } else {
551 if (ok) {
552 updateDisplay();
553 }
554 }
555 }
556
557 /*** Update the display */
558 private void updateDisplay() {
559 updateGpsTextFieldEnabled();
560 updatePositionTextFieldEnabled();
561
562 if ((ok) && (communicating) && (aligned)) {
563 updateHorizontalCoordinates();
564 updateEquatorialCoordinates();
565 }
566
567 if (gpsLinked) {
568 updateGps();
569 }
570
571 }
572
573 /***
574 * Cancel update
575 * @return True when canceled
576 */
577 public boolean cancel() {
578 ok = false;
579 azmTextField.setEnabled(ok);
580 altTextField.setEnabled(ok);
581 raTextField.setEnabled(ok);
582 decTextField.setEnabled(ok);
583 communicating = false;
584 gpsLinked = false;
585 updateGpsTextFieldEnabled();
586 aligned = false;
587 return super.cancel();
588 }
589
590 /***
591 * Update local horizontal coordinates (azimuth, altitude) display
592 */
593 private void updateHorizontalCoordinates() {
594
595 if (ok) {
596 Integer[] azm = getDegreesMinutesSeconds(horizCoord.getX());
597 azmTextField.setText(dmsFmt.format(
598 ResourceBundle.getBundle("resources/comm/Telescope").getString("DMS_FORMAT"),
599 azm));
600 }
601
602 if (ok) {
603 Integer[] alt = getDegreesMinutesSeconds(horizCoord.getY());
604 altTextField.setText(dmsFmt.format(
605 ResourceBundle.getBundle(
606 "com/raben/telescope/Telescope").getString("DMS_FORMAT"),
607 alt));
608 }
609
610 }
611
612 /***
613 * Update equatorial coordinates (right ascension, declination) display
614 */
615 private void updateEquatorialCoordinates() {
616 if (ok) {
617
618 Integer[] ra = getDegreesMinutesSeconds(eqCoord.getX());
619 raTextField.setText(hmsFmt.format(
620 ResourceBundle.getBundle(
621 "com/raben/telescope/Telescope").getString("HMS_FORMAT"),
622 ra));
623 }
624
625 if (ok) {
626 Integer[] dec = getDegreesMinutesSeconds(eqCoord.getY());
627 decTextField.setText(dmsFmt.format(
628 ResourceBundle.getBundle(
629 "com/raben/telescope/Telescope").getString("DMS_FORMAT"),
630 dec));
631 }
632 }
633
634 /***
635 * Update GPS date/time and geographical coordinate
636 */
637 private void updateGps() {
638 // Update date/time
639 if (ok) {
640 synchronized (gpsDateTime) {
641 gpsDateTimeTextField.setText(dateTimeFormat.format(
642 gpsDateTime.getTime()));
643 }
644 }
645
646 // Update GPS longitude
647 if (ok) {
648 double lat = 0.0;
649 double lon = 0.0;
650
651 synchronized (gpsCoordinate) {
652 lon = gpsCoordinate.getX();
653 lat = gpsCoordinate.getY();
654 }
655
656 Integer[] longitude = getDegreesMinutesSeconds(lon);
657 gpsLongitudeTextField.setText(dmsFmt.format(
658 ResourceBundle.getBundle(
659 "com/raben/telescope/Telescope").getString("DMS_FORMAT"),
660 longitude));
661
662 Integer[] latitude = getDegreesMinutesSeconds(lat);
663 gpsLatitudeTextfield.setText(dmsFmt.format(
664 ResourceBundle.getBundle(
665 "com/raben/telescope/Telescope").getString("DMS_FORMAT"),
666 latitude));
667 }
668
669 }
670
671 /*** Update GPS date/time, latitude, and longitude text field enable */
672 private void updateGpsTextFieldEnabled() {
673 gpsDateTimeTextField.setEnabled(gpsLinked);
674 gpsLongitudeTextField.setEnabled(gpsLinked);
675 gpsLatitudeTextfield.setEnabled(gpsLinked);
676 }
677
678 /*** Update telescope position text field enable */
679 private void updatePositionTextFieldEnabled() {
680 azmTextField.setEnabled(aligned);
681 altTextField.setEnabled(aligned);
682 raTextField.setEnabled(aligned);
683 decTextField.setEnabled(aligned);
684 }
685
686 }
687 }
Back
to Example 1 Next,
resources |