Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Query on JFileChooser class  RSS feed

 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Iam facing with one problem when Iam going to select file from my local Hard Drive of my machine for uploading by clicking on button it opens Dialogbox for selecting file it showing all drive but not showing Network Neighborhood in Dialog box.Plz guide how I can slove this problem.Below r codes:-

.............................
Button=new JButton(Upload);
Button.setToolTipText("Upload");
Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
try{
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Choose a File");
int ee=fc.showDialog(contentPane,"OK");
if (ee==1)return;
File a=fc.getSelectedFile(); String aa=a.getAbsolutePath();
String uploadFileName=(String)a.getName();
System.out.println("File Name="+uploadFileName);
.............
Thanks for ur valuable Time
Bikash
------------------
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It shows all of your network drives right? I am not sure what you are wanting it to do. Network Neighborhood is a Windows only thing so it won't show it.
 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stevens,
It is showing Drives only of my Machine not Networked Drive.I want to select file from my Local Networked Machine for upload.
If u have any solution plz extend to me.
Thanks for ur valuable Time
Bikash
------------------
 
alex earnshaw
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I am aware the only way you can view any drives in network neighbourhood is to actually 'map' that drive (e.g. to F: drive), so that it appears under my computer aswell as under network neighbourhood.
hth
alex
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!