X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosCompanionInfo.java;h=1ed2c425b4196acc6b5e9aaec53c10f7e18d6c26;hb=d203a2da2641bec21a4257c8a7b03d9a1eba53a5;hp=f287a8ea3348cb375b39d1595018c23467e446b9;hpb=c7f540330c040c521f9d7626009a406e704a5e41;p=fw%2Faltos diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java index f287a8ea..1ed2c425 100644 --- a/altosui/AltosCompanionInfo.java +++ b/altosui/AltosCompanionInfo.java @@ -18,38 +18,32 @@ 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_1.*; public class AltosCompanionInfo extends JTable { private AltosFlightInfoTableModel model; - private Font infoLabelFont = new Font("SansSerif", Font.PLAIN, 14); - private Font infoValueFont = new Font("Monospaced", Font.PLAIN, 14); - static final int info_columns = 2; static final int info_rows = 17; int desired_row_height() { - FontMetrics infoValueMetrics = getFontMetrics(infoValueFont); + FontMetrics infoValueMetrics = getFontMetrics(Altos.table_value_font); return (infoValueMetrics.getHeight() + infoValueMetrics.getLeading()) * 18 / 10; } + public void set_font() { + setFont(Altos.table_value_font); + setRowHeight(desired_row_height()); + doLayout(); + } + public AltosCompanionInfo() { super(new AltosFlightInfoTableModel(info_rows, info_columns)); model = (AltosFlightInfoTableModel) getModel(); - setFont(infoValueFont); setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS); setShowGrid(true); - setRowHeight(desired_row_height()); - doLayout(); + set_font(); } public Dimension getPreferredScrollableViewportSize() { @@ -89,11 +83,11 @@ public class AltosCompanionInfo extends JTable { } } - public void show(AltosState state, int crc_errors) { + public void show(AltosState state, AltosListenerState listener_state) { if (state == null) return; - if (state.data.companion != null) - companion = state.data.companion; + if (state.companion != null) + companion = state.companion; info_reset(); info_add_row(0, "Companion board", "%s", board_name()); if (companion != null) {