Sign in to follow this  
Followers 0
Original Poster

JFileChooser(); a lil stuck

5 posts in this topic

JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("Browse the folder to process");
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): "+ chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : "+ chooser.getSelectedFile());
} else {
System.out.println("No Selection ");
}

hello,

 

I am currently programming on a mac (os, 10.9.2), using eclipse trying to access a usb drive plugged into my mac, but I cannot see it using this code... I can see everything on my local machine but no drives, any help?

Share this post


Link to post
Share on other sites
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("Browse the folder to process");
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setAcceptAllFileFilterUsed(false);

if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): "+ chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : "+ chooser.getSelectedFile());
} else {
System.out.println("No Selection ");
}

hello,

 

I am currently programming on a mac (os, 10.9.2), using eclipse trying to access a usb drive plugged into my mac, but I cannot see it using this code... I can see everything on my local machine but no drives, any help?

 

 

Have you tried looking in the {hard-drive-name}/Volumes directory?

Share this post


Link to post
Share on other sites

Have you tried looking in the {hard-drive-name}/Volumes directory?

yes lol, sadly maybe I did not explain my self properly (i have a habit of this) I can obviously find my drives if I go through the very long and painful way, but it does not show up in the top drop down it only shows my home DIR and C drive was just wondering if maybe I am being silly

Share this post


Link to post
Share on other sites

yes lol, sadly maybe I did not explain my self properly (i have a habit of this) I can obviously find my drives if I go through the very long and painful way, but it does not show up in the top drop down it only shows my home DIR and C drive was just wondering if maybe I am being silly

No, that's it's intended functionality, the rest are just mounted into the existing filesystem - so you're not doing anything wrong, it's behaving exactly as it has been designed to do :)

Share this post


Link to post
Share on other sites

No, that's it's intended functionality, the rest are just mounted into the existing filesystem - so you're not doing anything wrong, it's behaving exactly as it has been designed to do :)

ah ok thank you :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.