diff options
author | Keith Packard <keithp@keithp.com> | 2010-08-22 23:05:20 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-08-22 23:05:20 -0700 |
commit | 953bc3438b10b21f3d65d292356c4ab2de23cddd (patch) | |
tree | 734b5d31700e93f462e19e0076df1f0956d5a581 /ao-tools/altosui/AltosChannelMenu.java | |
parent | e1463d8e265dfd42c824d90088cd2a51b4cf8131 (diff) |
altosui: Add TeleMetrum configuration
This presents a dialog with all of the user-settable options in the
TeleMetrum set for editing. Combo boxes are used for everything except
the callsign.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosChannelMenu.java')
-rw-r--r-- | ao-tools/altosui/AltosChannelMenu.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/ao-tools/altosui/AltosChannelMenu.java b/ao-tools/altosui/AltosChannelMenu.java new file mode 100644 index 00000000..504c13c6 --- /dev/null +++ b/ao-tools/altosui/AltosChannelMenu.java @@ -0,0 +1,70 @@ +/* + * Copyright © 2010 Keith Packard <keithp@keithp.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package altosui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.filechooser.FileNameExtensionFilter; +import javax.swing.table.*; +import java.io.*; +import java.util.*; +import java.text.*; +import java.util.prefs.*; +import java.util.concurrent.LinkedBlockingQueue; + +public class AltosChannelMenu extends JMenu implements ActionListener { + ButtonGroup group; + int channel; + LinkedList<ActionListener> listeners; + + public void addActionListener(ActionListener l) { + listeners.add(l); + } + + public void actionPerformed(ActionEvent e) { + channel = Integer.parseInt(e.getActionCommand()); + + ListIterator<ActionListener> i = listeners.listIterator(); + + ActionEvent newe = new ActionEvent(this, channel, e.getActionCommand()); + while (i.hasNext()) { + ActionListener listener = i.next(); + listener.actionPerformed(newe); + } + } + + public AltosChannelMenu(int current_channel) { + super("Channel", true); + group = new ButtonGroup(); + + channel = current_channel; + + listeners = new LinkedList<ActionListener>(); + for (int c = 0; c <= 9; c++) { + JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem(String.format("Channel %1d (%7.3fMHz)", c, + 434.550 + c * 0.1), + c == channel); + radioitem.setActionCommand(String.format("%d", c)); + radioitem.addActionListener(this); + add(radioitem); + group.add(radioitem); + } + } + +} |