X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosConfigFreqUI.java;h=5877805791ec28ef7f81859a2dbb226fd2df6fc6;hp=d68151ecc9b797234efe03585a5c2df30ea16e35;hb=9e18c524fa2d1f648f265b3c3105f5ceacf06c10;hpb=f03ca0ab8799bfa5100eaa2577cfd7b9c37d05bf diff --git a/altosui/AltosConfigFreqUI.java b/altosui/AltosConfigFreqUI.java index d68151ec..58778057 100644 --- a/altosui/AltosConfigFreqUI.java +++ b/altosui/AltosConfigFreqUI.java @@ -20,17 +20,11 @@ package altosui; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*; -import javax.swing.plaf.basic.*; -import java.io.*; import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*; +import org.altusmetrum.altoslib_3.*; +import org.altusmetrum.altosuilib_1.*; -class AltosEditFreqUI extends JDialog implements ActionListener { +class AltosEditFreqUI extends AltosUIDialog implements ActionListener { Frame frame; JTextField frequency; JTextField description; @@ -77,7 +71,7 @@ class AltosEditFreqUI extends JDialog implements ActionListener { GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets (4,4,4,4); - + c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.gridx = 0; @@ -132,7 +126,7 @@ class AltosEditFreqUI extends JDialog implements ActionListener { c.weightx = 0; c.weighty = 0; pane.add(ok_button, c); - + cancel_button = new JButton("Cancel"); cancel_button.setActionCommand("cancel"); cancel_button.addActionListener(this); @@ -145,7 +139,7 @@ class AltosEditFreqUI extends JDialog implements ActionListener { c.weightx = 0; c.weighty = 0; pane.add(cancel_button, c); - + if (existing == null) setTitle("Add New Frequency"); else { @@ -157,7 +151,7 @@ class AltosEditFreqUI extends JDialog implements ActionListener { pack(); setLocationRelativeTo(frame); - + } public AltosEditFreqUI(Frame in_frame) { @@ -165,7 +159,7 @@ class AltosEditFreqUI extends JDialog implements ActionListener { } } -public class AltosConfigFreqUI extends JDialog implements ActionListener { +public class AltosConfigFreqUI extends AltosUIDialog implements ActionListener { Frame frame; LinkedList listeners; @@ -177,9 +171,9 @@ public class AltosConfigFreqUI extends JDialog implements ActionListener { int i; for (i = 0; i < list_model.size(); i++) { AltosFrequency f = (AltosFrequency) list_model.get(i); - if (f.frequency == frequency.frequency) + if (frequency.frequency == f.frequency) return; - if (f.frequency > frequency.frequency) + if (frequency.frequency < f.frequency) break; } list_model.insertElementAt(frequency, i); @@ -246,7 +240,7 @@ public class AltosConfigFreqUI extends JDialog implements ActionListener { FrequencyList frequencies; void save_frequencies() { - AltosPreferences.set_common_frequencies(frequencies.frequencies()); + AltosUIPreferences.set_common_frequencies(frequencies.frequencies()); } JButton add, edit, remove; @@ -296,7 +290,7 @@ public class AltosConfigFreqUI extends JDialog implements ActionListener { public AltosFrequency[] frequencies() { return frequencies.frequencies(); } - + public AltosConfigFreqUI(Frame in_frame, AltosFrequency[] in_frequencies) { super(in_frame, "Manage Frequencies", true); @@ -411,7 +405,7 @@ public class AltosConfigFreqUI extends JDialog implements ActionListener { Frame frame = JOptionPane.getFrameForComponent(frameComp); AltosConfigFreqUI dialog; - dialog = new AltosConfigFreqUI(frame, AltosPreferences.common_frequencies()); + dialog = new AltosConfigFreqUI(frame, AltosUIPreferences.common_frequencies()); dialog.setVisible(true); }