FTP Progress Bar

Discussion in 'Java' started by stinehelferw, Dec 7, 2005.

  1. stinehelferw

    stinehelferw Guest

    Using net commons.
    Created a GUI FTP program similar to WS_FTP.
    All working well, but interested in adding progress bar.

    Looking at using a second thread to monitor the progress and report back to
    main.

    Here's the portion of program using ftp.retreivefile and FileOutputStream.

    leftButton.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e16) {
    // Retreive file(s) from remote system

    // Find name of selected file for download in JLIST
    String filename = remotefileList.getSelectedValue().toString();
    String[] splitArray = null;
    splitArray = filename.split(" ");
    int i;
    File destination = currentDir;

    try {
    messageTextArea.append("\n" + "Retreive File:" +
    splitArray[0].toString().trim());

    filename = splitArray[0].toString().trim();

    File path = new File( destination + File.separator + filename);

    FileOutputStream fos = new FileOutputStream( path );
    ftp.retrieveFile( filename, fos );

    messageTextArea.append("\n" + ftp.getReplyString()+ "\n");

    fos.close();

    filenameArray = currentDir.list();

    locallistModel.clear();
    locallistModel.addElement("[..]");
    for(i=0;i<filenameArray.length;i++)
    {
    locallistModel.addElement(filenameArray);
    }
    }
    catch(FileNotFoundException e) { }
    catch(IOException e) { }
    }});
     
    stinehelferw, Dec 7, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    0
    Views:
    3,567
  2. Charlie Zhang
    Replies:
    3
    Views:
    1,295
    Paul Lutus
    Aug 16, 2004
  3. =?iso-8859-1?q?St=E9phane_KLEIN?=

    [jakarta][FTP] progress bar transfert

    =?iso-8859-1?q?St=E9phane_KLEIN?=, Oct 5, 2004, in forum: Java
    Replies:
    1
    Views:
    531
    Paul Lutus
    Oct 5, 2004
  4. CatDude

    Progress bar in web-based ftp?

    CatDude, May 9, 2006, in forum: Python
    Replies:
    1
    Views:
    381
    Larry Bates
    May 9, 2006
  5. Rob

    progress bar or guage bar

    Rob, Jul 11, 2003, in forum: ASP General
    Replies:
    6
    Views:
    214
    Chris Barber
    Jul 12, 2003
Loading...

Share This Page