• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Java swing directory chooser

 
Rahul Raj cochin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used swing directory chooser to select input directory for my application to process.
But if I select a particular directory, for example..
c:/Desktop/user/documents/myfolder

filechooser.getcurrentDirectory() returns only "c:/Desktop/user/documents/".
Why? Can anyone say why this is happening?

 
Rahul Raj cochin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get the current directory, and not the parent directory..
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the mode to DIRECTORIES_ONLY and retrieve the selected file.
 
Rahul Raj cochin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is resolved.
I changed "filechooser.getcurrentDirectory()" to "filechooser.getSelectedFile()"
No further changes made..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic