JFileChooser Getting And Setting The Current Directory
Chapter:
Swing
Last Updated:
26-07-2016 08:22:39 UTC
Program:
/* ............... START ............... */
import java.io.File;
import javax.swing.JFileChooser;
public class JavaJFileChooserCurrentDirectory {
public static void main(String[] argv) throws Exception {
JFileChooser chooser = new JFileChooser();
File f = new File(new File(".").getCanonicalPath());
chooser.setCurrentDirectory(f);
chooser.setCurrentDirectory(null);
chooser.showOpenDialog(null);
File curDir = chooser.getCurrentDirectory();
}
}
/* ............... END ............... */
Output
Tags
JFileChooser Getting And Setting The Current Directory, Swing, Java