diff options
author | Keith Packard <keithp@keithp.com> | 2013-02-10 00:29:29 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-02-10 00:30:32 -0800 |
commit | 2efd3ad80d4fefa8ccc1b80a2e657dbf9ba0c60f (patch) | |
tree | 02fdd0be077d082702da5f150670437e080318e2 /altosuilib/AltosUIEnable.java | |
parent | 0169e56ad030c0096b1068d00f06957990dfb31f (diff) |
altosui/altoslib/altosuilib: Switch altosui to shared graph code
This adds a configuration tab to the graph window to enable/disable
various plotted values.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosuilib/AltosUIEnable.java')
-rw-r--r-- | altosuilib/AltosUIEnable.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/altosuilib/AltosUIEnable.java b/altosuilib/AltosUIEnable.java index 297cf320..55486dea 100644 --- a/altosuilib/AltosUIEnable.java +++ b/altosuilib/AltosUIEnable.java @@ -84,10 +84,38 @@ public class AltosUIEnable extends Container { y++; } + public void add_units() { + /* Imperial units setting */ + /* Add label */ + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 0; c.gridy = 1000; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + add(new JLabel("Imperial Units"), c); + + JRadioButton imperial_units = new JRadioButton("Enable", AltosUIPreferences.imperial_units()); + imperial_units.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JRadioButton item = (JRadioButton) e.getSource(); + boolean enabled = item.isSelected(); + AltosUIPreferences.set_imperial_units(enabled); + } + }); + imperial_units.setToolTipText("Use Imperial units instead of metric"); + c = new GridBagConstraints(); + c.gridx = 1; c.gridy = 1000; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + add(imperial_units, c); + } + public AltosUIEnable() { il = new Insets(4,4,4,4); ir = new Insets(4,4,4,4); y = 0; setLayout(new GridBagLayout()); + add_units(); } } |