+ void telemetry_window(AltosDevice device) {
+ try {
+ AltosFlightReader reader = new AltosTelemetryReader(device);
+ if (reader != null)
+ new AltosFlightUI(voice, reader, device.getSerial());
+ } catch (FileNotFoundException ee) {
+ JOptionPane.showMessageDialog(AltosUI.this,
+ String.format("Cannot open device \"%s\"",
+ device.getPath()),
+ "Cannot open target device",
+ JOptionPane.ERROR_MESSAGE);
+ } catch (AltosSerialInUseException si) {
+ JOptionPane.showMessageDialog(AltosUI.this,
+ String.format("Device \"%s\" already in use",
+ device.getPath()),
+ "Device in use",
+ JOptionPane.ERROR_MESSAGE);
+ } catch (IOException ee) {
+ JOptionPane.showMessageDialog(AltosUI.this,
+ device.getPath(),
+ "Unkonwn I/O error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ Container pane;
+ GridBagLayout gridbag;
+
+ JButton addButton(int x, int y, String label) {
+ GridBagConstraints c;
+ JButton b;
+
+ c = new GridBagConstraints();
+ c.gridx = x; c.gridy = y;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ c.weighty = 1;
+ b = new JButton(label);
+
+ Dimension ps = b.getPreferredSize();
+
+ gridbag.setConstraints(b, c);
+ add(b, c);
+ return b;
+ }
+