Getting path to file
in
Programming Questions
•
1 year ago
Hello all,
I've made this code:
void BookFile() {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(chooser.getAcceptAllFileFilter());
int returnVal = chooser.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
println("You chose to open this file: " +
chooser.getSelectedFile().getName());
bookInputfile.setText(chooser.getSelectedFile().getName());
bookfile1 = chooser.getSelectedFile().getName();
}
}
That gives me the filename in the text box, as well as setting "bookfile1." What I need now is the full path in both the textbox and the variable.
Does anyone have any information regarding what code to use?
Thanks!
1