summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosFlightUI.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-20 16:19:42 -0800
committerKeith Packard <keithp@keithp.com>2010-11-20 16:19:42 -0800
commitece2c86e2641b2cd613791293526c492b1606aa1 (patch)
tree3347cf13ca24292e523cce03e191ac3f4f35ff28 /ao-tools/altosui/AltosFlightUI.java
parent37f0201d724693528f37ac7d275f68f90cf94da0 (diff)
altosui: Rewrite info table to mix with scroll pane well. Fix startup size
Using a single table for the info table means that the scroll pane automatically picks up the table headers and shows them above the scrollable view. This patch also fixes the application size at startup so that no scrollbar is required in the info table, and the window is < 800x600. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosFlightUI.java')
-rw-r--r--ao-tools/altosui/AltosFlightUI.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/ao-tools/altosui/AltosFlightUI.java b/ao-tools/altosui/AltosFlightUI.java
index ac88aa15..d5bcdb10 100644
--- a/ao-tools/altosui/AltosFlightUI.java
+++ b/ao-tools/altosui/AltosFlightUI.java
@@ -44,7 +44,6 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
AltosLanded landed;
private AltosFlightStatus flightStatus;
- private JScrollPane flightInfoPane;
private AltosInfoTable flightInfo;
static final int tab_pad = 1;
@@ -66,14 +65,6 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
return tab_landed;
}
- public int width() {
- return flightInfo.width();
- }
-
- public int height() {
- return flightStatus.height() + flightInfo.height();
- }
-
void stop_display() {
if (thread != null && thread.isAlive()) {
thread.interrupt();
@@ -146,6 +137,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
setTitle(String.format("AltOS %s", reader.name));
+ /* Stick channel selector at top of table for telemetry monitoring */
if (serial >= 0) {
// Channel menu
channels = new AltosChannelMenu(AltosPreferences.channel(serial));
@@ -162,6 +154,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
bag.add (channels, c);
}
+ /* Flight status is always visible */
flightStatus = new AltosFlightStatus();
c.gridx = 0;
c.gridy = 1;
@@ -169,6 +162,9 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
c.weightx = 1;
bag.add(flightStatus, c);
+ /* The rest of the window uses a tabbed pane to
+ * show one of the alternate data views
+ */
pane = new JTabbedPane();
pad = new AltosPad();
@@ -184,9 +180,9 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
pane.add("Landed", landed);
flightInfo = new AltosInfoTable();
- flightInfoPane = new JScrollPane(flightInfo.box());
- pane.add("Table", flightInfoPane);
+ pane.add("Table", new JScrollPane(flightInfo));
+ /* Make the tabbed pane use the rest of the window space */
c.gridx = 0;
c.gridy = 2;
c.fill = GridBagConstraints.BOTH;
@@ -194,9 +190,6 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
c.weighty = 1;
bag.add(pane, c);
- this.setSize(this.getPreferredSize());
- this.validate();
-
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
@@ -209,7 +202,8 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
}
});
- this.setVisible(true);
+ pack();
+ setVisible(true);
thread = new AltosDisplayThread(this, voice, this, reader);