+ int i;
+ for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
+ AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
+
+ if (f.close(new_radio_frequency)) {
+ radio_frequency_value.setSelectedIndex(i);
+ return;
+ }
+ }
+ for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
+ AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
+
+ if (new_radio_frequency < f.frequency)
+ break;
+ }
+ String description = String.format("%s serial %s",
+ product_value.getText(),
+ serial_value.getText());
+ AltosFrequency new_frequency = new AltosFrequency(new_radio_frequency, description);
+ AltosPreferences.add_common_frequency(new_frequency);
+ radio_frequency_value.insertItemAt(new_frequency, i);
+ radio_frequency_value.setSelectedIndex(i);