JFileChooser Setting The Selected File In Java
Chapter:
Swing
Last Updated:
26-07-2016 07:58:16 UTC
Program:
/* ............... START ............... */
import java.io.File;
import javax.swing.JFileChooser;
public class JavaJFileChooserSelectFile {
public static void main(String[] argv) throws Exception{
JFileChooser chooser = new JFileChooser();
File f = new File(new File("filename.txt").getCanonicalPath());
chooser.setSelectedFile(f);
chooser.showOpenDialog(null);
chooser.getSelectedFile();
}
}
/* ............... END ............... */
Output
Tags
JFileChooser Setting The Selected File, Swing, Java