Merge branch 'master' into new-state
[fw/altos] / altosui / AltosCompanionInfo.java
index f287a8ea3348cb375b39d1595018c23467e446b9..1ed2c425b4196acc6b5e9aaec53c10f7e18d6c26 100644 (file)
 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) {