paulbradley
Programmer
I have the following code to get a file using a file chooser:
//**********
String filename = File.separator+"tmp";
JFileChooser fc = new JFileChooser(new File(filename));
fc.showOpenDialog(null);
File selectedFile = fc.getSelectedFile();
System.out.println(selectedFile);
Library lib = Library.load(selectedFile);
//****************
However, the last line won't compile as the filename passed to the load method in Library must be a String, can you parse the file name or is there another solution? Thanks.
//**********
String filename = File.separator+"tmp";
JFileChooser fc = new JFileChooser(new File(filename));
fc.showOpenDialog(null);
File selectedFile = fc.getSelectedFile();
System.out.println(selectedFile);
Library lib = Library.load(selectedFile);
//****************
However, the last line won't compile as the filename passed to the load method in Library must be a String, can you parse the file name or is there another solution? Thanks.