Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JFileChooser and network drives

Status
Not open for further replies.

msloan

Programmer
May 30, 2001
39
US
Is it possible to have a JFileChooser that is able to display network machines and drives? If so, how?

TIA
 


Hello,

This should work :

public void chooseFile() {
JFileChooser() chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.showOpenDialog(f); //f is a JFrame
System.out.println.setText("" +(Object)chooser.getSelectedFile());
}

Hope it works,

Ben
 
Thanks for the suggestion, but it doesn't do quite what I need it to - still showing only the local drives. I think during setup, I will have to instruct the user to map a network drive so it is shown in the JFileChooser.
 
Yeah, as far as I know, java will only see mapped drives using the code suggested - as it can't see drives which arn't connected ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top