summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-10-04 00:10:03 -0700
committerKeith Packard <keithp@keithp.com>2014-10-04 00:10:03 -0700
commita757fd5af53f5721a949181372548afa4757d6c9 (patch)
treeebd63f1a395eb4ff08f3e9bdc27796931430bb4c
parent656d8fe17532ca6c7d1d43996f187df2f14f5395 (diff)
altosui: Update 'Imperial Units' checkbox when units change
If you have two graphs running, make sure the imperial units checkboxes agree. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosGraphUI.java2
-rw-r--r--altosuilib/AltosUIEnable.java15
2 files changed, 13 insertions, 4 deletions
diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java
index 2d00fb45..df6f0540 100644
--- a/altosui/AltosGraphUI.java
+++ b/altosui/AltosGraphUI.java
@@ -64,6 +64,8 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt
public void units_changed(boolean imperial_units) {
if (map != null)
map.units_changed(imperial_units);
+ if (enable != null)
+ enable.units_changed(imperial_units);
}
AltosGraphUI(AltosStateIterable states, File file) throws InterruptedException, IOException {
diff --git a/altosuilib/AltosUIEnable.java b/altosuilib/AltosUIEnable.java
index e227d2b7..c1e4967e 100644
--- a/altosuilib/AltosUIEnable.java
+++ b/altosuilib/AltosUIEnable.java
@@ -37,12 +37,19 @@ import org.jfree.data.*;
public class AltosUIEnable extends Container {
- Insets il, ir;
- int y;
- int x;
+ Insets il, ir;
+ int y;
+ int x;
+ JCheckBox imperial_units;
static final int max_rows = 14;
+ public void units_changed(boolean imperial_units) {
+ if (this.imperial_units != null) {
+ this.imperial_units.setSelected(imperial_units);
+ }
+ }
+
class GraphElement implements ActionListener {
AltosUIGrapher grapher;
JCheckBox enable;
@@ -86,7 +93,7 @@ public class AltosUIEnable extends Container {
/* Imperial units setting */
/* Add label */
- JCheckBox imperial_units = new JCheckBox("Imperial Units", AltosUIPreferences.imperial_units());
+ imperial_units = new JCheckBox("Imperial Units", AltosUIPreferences.imperial_units());
imperial_units.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JCheckBox item = (JCheckBox) e.getSource();