X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosDescent.java;h=61709afe0e769aaae0333819b1b2c21d6f4c1413;hb=f9e1c5949a24e27897587b0b0ca00e089f362215;hp=0fcd690b781180548e31c8d5f13cdcd209a414c0;hpb=3d88e0493ab446d7c7011786390d30618a72d045;p=fw%2Faltos diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index 0fcd690b..61709afe 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -18,15 +18,8 @@ package altosui; import java.awt.*; -import java.awt.event.*; import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; +import org.altusmetrum.AltosLib.*; public class AltosDescent extends JComponent implements AltosFlightDisplay { GridBagLayout layout; @@ -118,6 +111,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { value.setVisible(false); } + void show(AltosUnits units, double v) { + value.setText(units.show(8, v)); + } + void show(String format, double v) { value.setText(String.format(format, v)); } @@ -238,7 +235,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { class Height extends DescentValue { void show (AltosState state, int crc_errors) { - show("%6.0f m", state.height); + show(AltosConvert.height, state.height); } public Height (GridBagLayout layout, int x, int y) { super (layout, x, y, "Height"); @@ -252,7 +249,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { double speed = state.speed; if (!state.ascent) speed = state.baro_speed; - show("%6.0f m/s", speed); + show(AltosConvert.speed, speed); } public Speed (GridBagLayout layout, int x, int y) { super (layout, x, y, "Speed"); @@ -345,7 +342,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { class Range extends DescentValue { void show (AltosState state, int crc_errors) { - show("%6.0f m", state.range); + show(AltosConvert.distance, state.range); } public Range (GridBagLayout layout, int x, int y) { super (layout, x, y, "Range");