X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosAscent.java;h=a158eb214d92ec33b4bec9c3597b5fb5f3c1630d;hb=67da878f740a387d0092631ad672e024d26e4192;hp=c8e5f3af07ea61fee1e21f4b8297fd22227d91d2;hpb=cbfbaabb39f9f7709d00cf3dc63cc1bc7563062e;p=fw%2Faltos diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java index c8e5f3af..a158eb21 100644 --- a/altosui/AltosAscent.java +++ b/altosui/AltosAscent.java @@ -27,6 +27,7 @@ import java.util.*; import java.text.*; import java.util.prefs.*; import java.util.concurrent.LinkedBlockingQueue; +import org.altusmetrum.AltosLib.*; public class AltosAscent extends JComponent implements AltosFlightDisplay { GridBagLayout layout; @@ -168,14 +169,14 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay { max_value.setFont(Altos.value_font); } - void show(String format, double v) { + void show(AltosUnits units, double v) { if (v == AltosRecord.MISSING) { value.setText("Missing"); max_value.setText("Missing"); } else { - value.setText(String.format(format, v)); + value.setText(units.show(8, v)); if (v > max || max == AltosRecord.MISSING) { - max_value.setText(String.format(format, v)); + max_value.setText(units.show(8, v)); max = v; } } @@ -220,7 +221,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay { class Height extends AscentValueHold { void show (AltosState state, int crc_errors) { - show("%6.0f m", state.height); + show(AltosConvert.height, state.height); } public Height (GridBagLayout layout, int y) { super (layout, y, "Height"); @@ -234,7 +235,7 @@ public class AltosAscent 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 y) { super (layout, y, "Speed"); @@ -245,7 +246,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay { class Accel extends AscentValueHold { void show (AltosState state, int crc_errors) { - show("%6.0f m/s²", state.acceleration); + show(AltosConvert.accel, state.acceleration); } public Accel (GridBagLayout layout, int y) { super (layout, y, "Acceleration");