Jump to content



Photo

JFileChooser(); a lil stuck


  • Please log in to reply
4 replies to this topic

#1 Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 12 June 2014 - 13:54

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?




#2 Kami-

Kami-

    ♫ d(-_-)b ♫

  • Tech Issues Solved: 3
  • Joined: 28-July 08
  • Location: SandBox

Posted 13 June 2014 - 11:37

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?



#3 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 13 June 2014 - 12:30

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



#4 Kami-

Kami-

    ♫ d(-_-)b ♫

  • Tech Issues Solved: 3
  • Joined: 28-July 08
  • Location: SandBox

Posted 18 June 2014 - 11:39

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 :)



#5 OP Original Poster

Original Poster

    Systems Developer

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7/8, Kali, ubuntu, OSx 10.9
  • Phone: Android

Posted 18 June 2014 - 20:36

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