hi ppl
i wanna access files of remotely places or lan connected computers using jfilechooser..
can u plzzz help me with this am in a bit confusion mode..
i hav tried with jfilechooser for loacl files but not for lan connected one so plz help me out
Printable View
hi ppl
i wanna access files of remotely places or lan connected computers using jfilechooser..
can u plzzz help me with this am in a bit confusion mode..
i hav tried with jfilechooser for loacl files but not for lan connected one so plz help me out
i hav tried this but thr is not network button in thisCode:import java.lang.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.event.*;
import javax.swing.*;
import javax.swing.filechooser.*;
import java.io.*;
import java.net.*;
class BR
{
String InputFilePath="";
JTextField txtPath=new JTextField("");
ServerSocket ss;
Socket s;
BR()
{
txtPath.setBounds(50,15,400,20);
txtPath.setEditable(false);
try
{
//Create server socket
ServerSocket ss = new ServerSocket(888);
//connect to its client socket
Socket s = ss.accept();
System.out.println("Connection established");
JFileChooser tFileChooser=new JFileChooser();
tFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int tResult=tFileChooser.showOpenDialog(new JFrame());
if(tResult==JFileChooser.APPROVE_OPTION)
{
InputFilePath=tFileChooser.getSelectedFile().getPath();
//txtPath.setText(InputFilePath);
//PGM tpgm=new PGM();
//tpgm.setFilePath(InputFilePath);
//tpgm.readImage();
//pbInput.setImage(tpgm.getBufferedImage());
}
ss.close();
s.close();
}catch(Exception e){}
}
public static void main(String args[])
{
BR b= new BR();
}
}
Get rid of all that socket stuff, display your JFileChooser again and press the 'up directory' button a couple of times; you'll see a 'network' button/folder; press it and see for yourself.
kind regards,
Jos
ya will try that n inform u
thank you