import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.*;
+import org.altusmetrum.AltosLib.*;
import libaltosJNI.*;
-public class AltosUI extends JFrame {
+public class AltosUI extends AltosFrame {
public AltosVoice voice = new AltosVoice();
public static boolean load_library(Frame frame) {
void telemetry_window(AltosDevice device) {
try {
- AltosFlightReader reader = new AltosTelemetryReader(device);
+ AltosFlightReader reader = new AltosTelemetryReader(new AltosSerial(device));
if (reader != null)
new AltosFlightUI(voice, reader, device.getSerial());
} catch (FileNotFoundException ee) {
JOptionPane.showMessageDialog(AltosUI.this,
- String.format("Cannot open device \"%s\"",
- device.toShortString()),
+ ee.getMessage(),
"Cannot open target device",
JOptionPane.ERROR_MESSAGE);
} catch (AltosSerialInUseException si) {
if (imgURL != null)
setIconImage(new ImageIcon(imgURL).getImage());
- AltosPreferences.set_component(this);
+ AltosUIPreferences.set_component(this);
pane = getContentPane();
gridbag = new GridBagLayout();
});
b.setToolTipText("Check flight readiness of altimeter in idle mode");
+ b = addButton(3, 2, "Launch Controller");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ LaunchController();
+ }
+ });
+
setTitle("AltOS");
pane.doLayout();
String result;
result = JOptionPane.showInputDialog(AltosUI.this,
"Configure Callsign",
- AltosPreferences.callsign());
+ AltosUIPreferences.callsign());
if (result != null)
- AltosPreferences.set_callsign(result);
+ AltosUIPreferences.set_callsign(result);
}
void ConfigureTeleMetrum() {
new AltosSiteMapPreload(AltosUI.this);
}
+ void LaunchController() {
+ new AltosLaunchUI(AltosUI.this);
+ }
+
/*
* Replay a flight from telemetry data
*/
else
return new AltosTelemetryIterable(in);
} catch (FileNotFoundException fe) {
- System.out.printf("Cannot open '%s'\n", filename);
+ System.out.printf("%s\n", fe.getMessage());
return null;
}
}
try {
return new AltosCSV(file);
} catch (FileNotFoundException fe) {
- System.out.printf("Cannot open '%s'\n", filename);
+ System.out.printf("%s\n", fe.getMessage());
return null;
}
}
try {
return new AltosKML(file);
} catch (FileNotFoundException fe) {
- System.out.printf("Cannot open '%s'\n", filename);
+ System.out.printf("%s\n", fe.getMessage());
return null;
}
}
public static void main(final String[] args) {
try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ UIManager.setLookAndFeel(AltosUIPreferences.look_and_feel());
} catch (Exception e) {
}
/* Handle batch-mode */