+ JFileChooser csv_chooser;
+ JPanel accessory;
+ JComboBox combo_box;
+ AltosRecordIterable iterable;
+ AltosWriter writer;
+
+ static String[] combo_box_items = { "Comma Separated Values (.CSV)", "Googleearth Data (.KML)" };
+
+ void set_default_file() {
+ File current = csv_chooser.getSelectedFile();
+ String current_name = current.getName();
+ String new_name = null;
+ String selected = (String) combo_box.getSelectedItem();
+
+ if (selected.contains("CSV"))
+ new_name = Altos.replace_extension(current_name, ".csv");
+ else if (selected.contains("KML"))
+ new_name = Altos.replace_extension(current_name, ".kml");
+ if (new_name != null)
+ csv_chooser.setSelectedFile(new File(new_name));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("comboBoxChanged"))
+ set_default_file();
+ }