Results 1 to 5 of 5
  1. #1
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default accessing remote computer using jfilechooser

    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

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,774
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by afreaz View Post
    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
    A JFileChooser also has a 'network' button; click it and see.

    kind regards,

    Jos

  3. #3
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    Java Code:
    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();
    	}
    }
    i hav tried this but thr is not network button in this

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,774
    Blog Entries
    7
    Rep Power
    21

    Default

    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

  5. #5
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 12-01-2011, 07:40 AM
  2. Remote deploy and remote work with JBoss AS
    By chalda in forum Eclipse
    Replies: 2
    Last Post: 03-08-2010, 12:17 PM
  3. : Accessing remote directory???
    By vaskarbasak in forum AWT / Swing
    Replies: 3
    Last Post: 10-15-2009, 09:19 AM
  4. Accessing Remote Serial Port
    By ali_sakar in forum New To Java
    Replies: 0
    Last Post: 03-23-2009, 12:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •