X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroFileChooser.java;h=c7a6d782c7abc06ffe8a74973abc86d706951d10;hp=0fd63a27469b74cd1194dab9249f947bca69c4a1;hb=23075d174d2bff8ff3f3deef3c3d90b83da6bd2e;hpb=9da9adc2718928de2af65a68cddbcc636cc3e9e8 diff --git a/micropeak/MicroFileChooser.java b/micropeak/MicroFileChooser.java index 0fd63a27..c7a6d782 100644 --- a/micropeak/MicroFileChooser.java +++ b/micropeak/MicroFileChooser.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,7 +21,8 @@ package org.altusmetrum.micropeak; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.*; -import org.altusmetrum.AltosLib.*; +import org.altusmetrum.altoslib_13.*; +import org.altusmetrum.altosuilib_13.*; public class MicroFileChooser extends JFileChooser { JFrame frame; @@ -35,24 +37,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 +51,6 @@ public class MicroFileChooser extends JFileChooser { setDialogTitle("Select MicroPeak Data File"); setFileFilter(new FileNameExtensionFilter("MicroPeak data file", "mpd")); + setCurrentDirectory(AltosUIPreferences.last_logdir()); } }