X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosIdleMonitorUI.java;h=6da920e29cb89e30f90338cc7e8fef9f74c7ca4a;hp=8c883eebfc0cd8a5fdda2cf44d9e8095824c96e3;hb=8fdbdebdbb4d1579fd2af47430807d0d2a78105b;hpb=c2701ae646124f0668c5f2d1df3fc80f0075a9d7 diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 8c883eeb..6da920e2 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -23,7 +23,8 @@ import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_1.*; +import java.util.Arrays; +import org.altusmetrum.altoslib_2.*; import org.altusmetrum.altosuilib_1.*; public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosFontListener, AltosIdleMonitorListener, DocumentListener { @@ -38,7 +39,10 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl void stop_display() { if (thread != null) { - thread.abort(); + try { + thread.abort(); + } catch (InterruptedException ie) { + } } thread = null; } @@ -63,21 +67,21 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl AltosFlightStatusUpdate status_update; - public void show(AltosState state, int crc_errors) { + public void show(AltosState state, AltosListenerState listener_state) { status_update.saved_state = state; - try { - pad.show(state, crc_errors); - flightStatus.show(state, crc_errors); - flightInfo.show(state, crc_errors); - } catch (Exception e) { - System.out.print("Show exception" + e); - } +// try { + pad.show(state, listener_state); + flightStatus.show(state, listener_state); + flightInfo.show(state, listener_state); +// } catch (Exception e) { +// System.out.print("Show exception " + e); +// } } - public void update(final AltosState state) { + public void update(final AltosState state, final AltosListenerState listener_state) { Runnable r = new Runnable() { public void run() { - show(state, 0); + show(state, listener_state); } }; SwingUtilities.invokeLater(r); @@ -191,7 +195,13 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { - disconnect(); + System.out.printf("Closing idle monitor window\n"); + try { + disconnect(); + } catch (Exception ex) { + System.out.println(Arrays.toString(ex.getStackTrace())); + } + System.out.printf("hiding\n"); setVisible(false); dispose(); AltosUIPreferences.unregister_font_listener(AltosIdleMonitorUI.this);