import java.util.prefs.*;
import java.util.concurrent.*;
-public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
+class AltosFlightStatusUpdate implements ActionListener {
+
+ public AltosState saved_state;
+ AltosFlightStatus flightStatus;
+
+ public void actionPerformed (ActionEvent e) {
+ if (saved_state != null)
+ flightStatus.show(saved_state, 0);
+ }
+
+ public AltosFlightStatusUpdate (AltosFlightStatus in_flightStatus) {
+ flightStatus = in_flightStatus;
+ }
+}
+
+public class AltosFlightUI extends AltosFrame implements AltosFlightDisplay, AltosFontListener {
AltosVoice voice;
AltosFlightReader reader;
AltosDisplayThread thread;
sitemap.reset();
}
+ public void set_font() {
+ pad.set_font();
+ ascent.set_font();
+ descent.set_font();
+ landed.set_font();
+ flightStatus.set_font();
+ flightInfo.set_font();
+ sitemap.set_font();
+ companion.set_font();
+ }
+
+ public void font_size_changed(int font_size) {
+ set_font();
+ }
+
+
+ AltosFlightStatusUpdate status_update;
+
public void show(AltosState state, int crc_errors) {
+ status_update.saved_state = state;
JComponent tab = which_tab(state);
try {
pad.show(state, crc_errors);
AltosFreqList frequencies;
JComboBox telemetries;
+ ActionListener show_timer;
+
public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {
AltosPreferences.set_component(this);
bag.add(pane, c);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+
+ AltosPreferences.register_font_listener(this);
+
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
disconnect();
setVisible(false);
dispose();
+ AltosPreferences.unregister_font_listener(AltosFlightUI.this);
if (exit_on_close)
System.exit(0);
}
thread = new AltosDisplayThread(this, voice, this, reader);
+ status_update = new AltosFlightStatusUpdate(flightStatus);
+
+ new javax.swing.Timer(100, status_update).start();
+
thread.start();
}