Reputation: 63
I am trying to create a 'Save to' file chooser. However when i execute the code and hit 'Open' a new filechooser window is opened. The code:
int val = jFileChooser1.showOpenDialog(null);
private void jFileChooser1ActionPerformed(java.awt.event.ActionEvent evt) {
System.out.println(evt.getActionCommand());
int val = jFileChooser1.showOpenDialog(null);
if(val == jFileChooser1.APPROVE_OPTION){
File filePath = jFileChooser1.getSelectedFile();
directoryPath = filePath.toString();
System.out.println("Directory Path: " + directoryPath);
}else{
System.exit(0);
}
}
Upvotes: 3
Views: 249