altoslib: Use symbols in AltosRomconfig instead of fixed offsets
[fw/altos] / micropeak / MicroFileChooser.java
index 0fd63a27469b74cd1194dab9249f947bca69c4a1..3ca128ee97bfddc79cefd3f55ad77d2162b7b528 100644 (file)
@@ -20,7 +20,8 @@ package org.altusmetrum.micropeak;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
-import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altoslib_2.*;
+import org.altusmetrum.altosuilib_1.*;
 
 public class MicroFileChooser extends JFileChooser {
        JFrame  frame;
@@ -35,24 +36,12 @@ public class MicroFileChooser extends JFileChooser {
                return file;
        }
 
-       public InputStream runDialog() {
+       public File runDialog() {
                int     ret;
 
                ret = showOpenDialog(frame);
-               if (ret == APPROVE_OPTION) {
-                       file = getSelectedFile();
-                       if (file == null)
-                               return null;
-                       filename = file.getName();
-                       try {
-                               return new FileInputStream(file);
-                       } catch (FileNotFoundException fe) {
-                               JOptionPane.showMessageDialog(frame,
-                                                             fe.getMessage(),
-                                                             "Cannot open file",
-                                                             JOptionPane.ERROR_MESSAGE);
-                       }
-               }
+               if (ret == APPROVE_OPTION)
+                       return getSelectedFile();
                return null;
        }
 
@@ -61,5 +50,6 @@ public class MicroFileChooser extends JFileChooser {
                setDialogTitle("Select MicroPeak Data File");
                setFileFilter(new FileNameExtensionFilter("MicroPeak data file",
                                                          "mpd"));
+               setCurrentDirectory(AltosUIPreferences.last_logdir());
        }
 }