From cbfbaabb39f9f7709d00cf3dc63cc1bc7563062e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 24 Aug 2011 19:13:03 -0700 Subject: altosui: Make flight monitor font size configurable Tiny netbooks aren't tall enough for the 'usual' font size, so provide a smaller option. Then provide a bigger option, just because. Signed-off-by: Keith Packard --- altosui/AltosCompanionInfo.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'altosui/AltosCompanionInfo.java') diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java index f287a8ea..82bde623 100644 --- a/altosui/AltosCompanionInfo.java +++ b/altosui/AltosCompanionInfo.java @@ -31,25 +31,26 @@ import java.util.concurrent.LinkedBlockingQueue; 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() { -- cgit v1.2.3