Java Swing application to upload files to FTP server with progress bar
Swing-based application that uploads files from local computer to a remote FTP server. The application looks like this.
The following diagram describes workflow of the application:
The Swing client application connects to the server via FTP protocol to transfer files. The FTP library to be used is Apache Commons Net.
The following class diagram depicts how the application is designed:
The main classes are:
-
FTPUtility
: implements FTP file upload functionality.UploadTask
: executes the file upload task in a background thread other than the Swing’s event dispatcher thread (EDT), so the GUI won’t become freezing.SwingFileUploadFTP
: assembles user interface of the application. It allows users to specify FTP server information (host, port, username, password and upload destination), choose a file to be uploaded. It shows a progress bar while the upload is taking place.
For the classes JFilePicker
and FileTypeFilter
, its source code can be obtained from article File picker component in Swing. The FTPException
is a custom exception class.