fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
void chooseButtonDirectory_actionPerformed(ActionEvent e) { try { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(fileChooser.DIRECTORIES_ONLY); System.out.println("here is directories"); int n = fileChooser.showOpenDialog(this.getContentPane()); if (n == fileChooser.APPROVE_OPTION) { textFieldFileLocalDirectory.setText(fileChooser.getSelectedFile().getPath());
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
try {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(fileChooser.DIRECTORIES_ONLY);
System.out.println("here is directories"); int n = fileChooser.showOpenDialog(this.getContentPane());
if (n == fileChooser.APPROVE_OPTION)
{ textFieldFileLocalDirectory.setText(fileChooser.getSelectedFile().getPath());
}
} catch (Exception ex) {
ex.printStackTrace();
} }