+
+ b = addButton(1, 1, "Configure AltosUI");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ConfigureAltosUI();
+ }
+ });
+
+ b = addButton(2, 1, "Flash Image");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ FlashImage();
+ }
+ });
+
+ b = addButton(3, 1, "Fire Igniter");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ FireIgniter();
+ }
+ });
+
+ b = addButton(4, 1, "Quit");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ System.exit(0);
+ }
+ });
+
+ setTitle("AltOS");
+
+ pane.doLayout();
+ pane.validate();
+
+ doLayout();
+ validate();
+
+ setVisible(true);
+
+ Insets i = getInsets();
+ Dimension ps = rootPane.getPreferredSize();
+ ps.width += i.left + i.right;
+ ps.height += i.top + i.bottom;
+ setPreferredSize(ps);
+ setSize(ps);
+ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ }
+
+ private void ConnectToDevice() {
+ AltosDevice device = AltosDeviceDialog.show(AltosUI.this,
+ AltosDevice.product_basestation);
+
+ if (device != null)
+ telemetry_window(device);
+ }
+
+ void ConfigureCallsign() {
+ String result;
+ result = JOptionPane.showInputDialog(AltosUI.this,
+ "Configure Callsign",
+ AltosPreferences.callsign());
+ if (result != null)
+ AltosPreferences.set_callsign(result);
+ }
+
+ void ConfigureTeleMetrum() {
+ new AltosConfig(AltosUI.this);
+ }
+
+ void FlashImage() {
+ new AltosFlashUI(AltosUI.this);
+ }
+
+ void FireIgniter() {
+ new AltosIgniteUI(AltosUI.this);
+ }
+
+ /*
+ * Replay a flight from telemetry data
+ */
+ private void Replay() {
+ AltosDataChooser chooser = new AltosDataChooser(
+ AltosUI.this);
+
+ AltosRecordIterable iterable = chooser.runDialog();
+ if (iterable != null) {
+ AltosFlightReader reader = new AltosReplayReader(iterable.iterator(),
+ chooser.filename());
+ new AltosFlightUI(voice, reader);