X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosConfigPyroUI.java;h=b14c39ab86e1c5ea2f0ca74d92194003d66394a3;hb=6dad9ca543fbed3f849b01300224b1b21ef2eb08;hp=81d121119acce8c580343078132213a95f9a9bd5;hpb=82b42935d047d2f7c2f7a63a3efb72a3f1d5594e;p=fw%2Faltos diff --git a/altosui/AltosConfigPyroUI.java b/altosui/AltosConfigPyroUI.java index 81d12111..b14c39ab 100644 --- a/altosui/AltosConfigPyroUI.java +++ b/altosui/AltosConfigPyroUI.java @@ -21,12 +21,12 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altoslib_2.*; +import org.altusmetrum.altoslib_3.*; import org.altusmetrum.altosuilib_1.*; public class AltosConfigPyroUI extends AltosUIDialog - implements ItemListener, DocumentListener, AltosUnitsListener + implements ItemListener, DocumentListener, AltosUnitsListener, ActionListener { AltosConfigUI owner; Container pane; @@ -48,7 +48,7 @@ public class AltosConfigPyroUI class PyroItem implements ItemListener, DocumentListener, AltosUnitsListener { public int flag; - public JRadioButton enable; + public JCheckBox enable; public JTextField value; public JComboBox combo; AltosConfigPyroUI ui; @@ -146,7 +146,7 @@ public class AltosConfigPyroUI c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = il; - enable = new JRadioButton(); + enable = new JCheckBox(); enable.addItemListener(this); pane.add(enable, c); @@ -232,7 +232,7 @@ public class AltosConfigPyroUI c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.CENTER; c.insets = il; - label = new JLabel(String.format("Pyro Channel %d", channel)); + label = new JLabel(String.format("Pyro Channel %c", 'A' + channel)); pane.add(label, c); y++; @@ -309,6 +309,14 @@ public class AltosConfigPyroUI } } + /* Listen for events from our buttons */ + public void actionPerformed(ActionEvent e) { + String cmd = e.getActionCommand(); + + if (cmd.equals("Close")) + setVisible(false); + } + public AltosConfigPyroUI(AltosConfigUI in_owner, AltosPyro[] pyros) { super(in_owner, "Configure Pyro Channels", false); @@ -353,6 +361,17 @@ public class AltosConfigPyroUI columns[i] = new PyroColumn(this, i*2 + 1, 0, i); columns[i].set(pyros[i]); } + + c = new GridBagConstraints(); + c.gridx = pyros.length*2-1; + c.fill = GridBagConstraints.HORIZONTAL; + c.gridwidth = 2; + c.gridy = 1000; + JButton close = new JButton("Close"); + pane.add(close, c); + close.addActionListener(this); + close.setActionCommand("Close"); + addWindowListener(new ConfigListener(this, owner)); AltosPreferences.register_units_listener(this); }