micropeak: Add ReadMe.rtf to Mac distribution
[fw/altos] / micropeak / MicroSave.java
index cb4b4221d3b0b0d2e14ff7b121cfc7969e8863b8..7879ff90bd8b60289418ac8ea5a92583d04f4daf 100644 (file)
@@ -32,6 +32,12 @@ public class MicroSave extends JFileChooser {
        JFrame          frame;
        MicroData       data;
 
+       public static void save(File file, MicroData data) throws FileNotFoundException, IOException {
+               FileOutputStream fos = new FileOutputStream(file);
+               data.save(fos);
+               fos.close();
+       }
+
        public boolean runDialog() {
                int     ret;
 
@@ -76,9 +82,7 @@ public class MicroSave extends JFileChooser {
                                }
                        }
                        try {
-                               FileOutputStream fos = new FileOutputStream(file);
-                               data.save(fos);
-                               fos.close();
+                               save(file, data);
                                data.set_name(filename);
                                return true;
                        } catch (FileNotFoundException fe) {
@@ -98,5 +102,6 @@ public class MicroSave extends JFileChooser {
                setFileFilter(new FileNameExtensionFilter("MicroPeak data file",
                                                          "mpd"));
                setCurrentDirectory(AltosUIPreferences.logdir());
+               setSelectedFile(MicroFile.make());
        }
 }