This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Problem with Java swing directory chooser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with Java swing directory chooser " Watch "Problem with Java swing directory chooser " New topic
Author

Problem with Java swing directory chooser

Rahul Raj cochin
Greenhorn

Joined: Mar 29, 2012
Posts: 9
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

Joined: Mar 29, 2012
Posts: 9
I want to get the current directory, and not the parent directory..
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 5048
    
  10

Set the mode to DIRECTORIES_ONLY and retrieve the selected file.


luck, db
There are no new questions, but there may be new answers.
Rahul Raj cochin
Greenhorn

Joined: Mar 29, 2012
Posts: 9
The problem is resolved.
I changed "filechooser.getcurrentDirectory()" to "filechooser.getSelectedFile()"
No further changes made..
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 5048
    
  10

Rahul, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/awt-swing/59482-problem-java-swing-directory-chooser.html

edit And http://forums.digitalpoint.com/showthread.php?t=2469894&s=71b196d4865b761443d63c4690d9fa1e#post17641360
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Java swing directory chooser
 
It's not a secret anymore!