String path = f.getAbsolutePath();
if (path != null && !"".equals(path)) {
chooser.setCurrentDirectory(new File(path));
}
}
int returnVal = chooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
// System.out.println("You chose to open this file: " +
// chooser.getSelectedFile().getName());
try {
fileNameField.setText(chooser.getSelectedFile().getCanonicalPath());