List of usage examples for javax.swing JFileChooser setSelectedFiles
@BeanProperty(description = "The list of selected files if the chooser is in multiple selection mode.") public void setSelectedFiles(File[] selectedFiles)
From source file:Main.java
public static void main(String[] argv) throws Exception { JFileChooser chooser = new JFileChooser(); File f = new File(new File("filename.txt").getCanonicalPath()); chooser.setSelectedFiles(new File[] { f }); chooser.showDialog(new JFrame(""), null); File curFile = chooser.getSelectedFile(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JFileChooser chooser = new JFileChooser(); File f = new File(new File("filename.txt").getCanonicalPath()); chooser.setSelectedFiles(new File[] { f }); chooser.showOpenDialog(null);/*from www .ja v a 2 s. c om*/ File curFile = chooser.getSelectedFile(); }