Java Copy Progress Bar
Posted on
Java Swing How to - Update JProgressBar in Thread. Back to JProgressBar ↑ Question. We would like to know how to update JProgressBar in Thread. Back on June c00kiemon5ter wrote a cli progress bar in java. As it seems it isn’t something difficult but I find it pretty usefull and worth to be mentioned. The progress bar was originally written as part of F.I.C.
Hi,I wrote a small application which up- and downloads galleries from my site. The application is running fine, but when I transfer a big gallery or multiple galleries my application stands still till all work is done. I wish to see a progress bar while my application is busy in background and display an estimated remaining time till completetion.
I worked with the threading tutorial from sun and looked up about 100 sites on google, but I could either find a corresponding solution or was to dumb to understand it. I hope you people can help me.
The upload works like this:
1. Read gallery data, an object that contains data like how many pictures are in this gallery and what are their names, title, etc.
2. Create a FTP connection to my online repository.
3. Transfer each picture in the gallery to my online repository.
4. Close FTP connection
5. Transfer remaining gallery data into my mySQL database hosted in my online repository.
6. Finished!
Java Swing Progress Bar
The download works like this:
1. Read gallery data from my mySQL database.
2. Write gallery data to the local machine
3. Create a FTP connection to my online repository.
4. Transfer each picture in the gallery from my online repository.
5. Close FTP connection
6. Finished!
The progess bar should indicate the current step like:
- Creating connection to online repository.
- Transferring picture x of n (picture name)
- Closing connection.
- Writing gallery data to database.
and the overall progress. Something like this:
+-------------------------------------------------------------------------+
Upload in progress X
+-------------------------------------------------------------------------+
Tranferring picture 2 of 401 (200801101800000000.jpg)...
// 2%
Remaining: 2 min. 54 sec.
+-------------------------------------------------------------------------+
I have added code snippets for the up- and download of a gallery.
Anyone knows how to implement a progress bar like this or knows a good reference I can
build on?
Greetz,
CB