From: Anthony Towns Date: Sat, 20 Nov 2010 08:20:45 +0000 (+1000) Subject: Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox X-Git-Tag: debian/0.7.1+117+ge7954c8~8^2~9 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=74cab8503b51ba6fb05a4d12a031c749e870b0ef;hp=0ecf033110084f1a8be98282d7029dc14f70dab5 Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox --- diff --git a/ao-tools/altosui/AltosChannelMenu.java b/ao-tools/altosui/AltosChannelMenu.java index 8069c853..abbb86f4 100644 --- a/ao-tools/altosui/AltosChannelMenu.java +++ b/ao-tools/altosui/AltosChannelMenu.java @@ -30,31 +30,11 @@ import java.util.concurrent.LinkedBlockingQueue; public class AltosChannelMenu extends JComboBox implements ActionListener { int channel; - LinkedList listeners; - - public void addActionListener(ActionListener l) { - listeners.add(l); - } - - public void actionPerformed(ActionEvent e) { - channel = getSelectedIndex(); - - ActionEvent newe = new ActionEvent(this, channel, e.getActionCommand()); - - ListIterator i = listeners.listIterator(); - - while (i.hasNext()) { - ActionListener listener = i.next(); - listener.actionPerformed(newe); - } - setMaximumSize(getPreferredSize()); - } public AltosChannelMenu(int current_channel) { channel = current_channel; - listeners = new LinkedList(); for (int c = 0; c <= 9; c++) addItem(String.format("Channel %1d (%7.3fMHz)", c, 434.550 + c * 0.1)); setSelectedIndex(channel); diff --git a/ao-tools/altosui/AltosFlightUI.java b/ao-tools/altosui/AltosFlightUI.java index 21b41528..6db6c67b 100644 --- a/ao-tools/altosui/AltosFlightUI.java +++ b/ao-tools/altosui/AltosFlightUI.java @@ -131,6 +131,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay { } Container bag; + JComboBox channels; public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) { AltosPreferences.init(this); @@ -151,10 +152,10 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay { if (serial >= 0) { // Channel menu - JComboBox channels = new AltosChannelMenu(AltosPreferences.channel(serial)); + channels = new AltosChannelMenu(AltosPreferences.channel(serial)); channels.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int channel = Integer.parseInt(e.getActionCommand()); + int channel = channels.getSelectedIndex(); reader.set_channel(channel); AltosPreferences.set_channel(serial, channel); }