I use JFileChooser in the application to search for a directory, but when I select a directory, it returns the path to the folder above the folder I selected. that is, I select "C: \ Test" and return "C: \"
Here is the code I'm using
JFileChooser c = new JFileChooser(); c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int rVal = c.showSaveDialog(c); if (rVal == JFileChooser.APPROVE_OPTION) { txtDirectory.setText(""); CC_Test.MsgBox(c.getCurrentDirectory().toString()); txtDirectory.setText(c.getCurrentDirectory().toString()); } if (rVal == JFileChooser.CANCEL_OPTION) { txtDirectory.setText(""); }
Talon06
source share