JFileChooser returns wrong getCurrentDirectory()?

this code doesnt returnt the correct current dirrectory? it appears to always returns the directory one higher than i want... any idea why?

JFileChooser chooser =new JFileChooser();

chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

chooser.setVisible(true);

//get the return value

int returnVal = chooser.showOpenDialog(null);

if(returnVal == JFileChooser.OPEN_DIALOG){

System.out.println("It is going to be written to the location: " +

chooser.getCurrentDirectory() );

}

Message was edited by:

helen_166

[866 byte] By [helen_166] at [2007-11-26 12:17:27]
# 1
use System.out.println("It is going to be written to the location: " +chooser.getSelectedFile() );
PhHein at 2007-7-7 14:55:01 > top of Java-index,Archived Forums,Socket Programming...
# 2
that doesnt help because i want to select a folder location and not a file
helen_166 at 2007-7-7 14:55:01 > top of Java-index,Archived Forums,Socket Programming...
# 3
Read the File API and try it again.
PhHein at 2007-7-7 14:55:01 > top of Java-index,Archived Forums,Socket Programming...
# 4
After reading File API read JFileChooser API concentrating on getCurrentDirectory() method
hellbinder at 2007-7-7 14:55:01 > top of Java-index,Archived Forums,Socket Programming...
# 5
chooser.getSelectedFile().getAbsolutePath() thanks
helen_166 at 2007-7-7 14:55:01 > top of Java-index,Archived Forums,Socket Programming...