Jon
Jon

Reputation: 739

Displaying a progress bar and linking it to a download

I am downloading a large file from the internet within my code and would like to show the user a progress bar to show how far along the download is, preferably in a separate pop-up box.

How would I go about doing this?

Upvotes: 1

Views: 470

Answers (3)

user207421
user207421

Reputation: 311050

See javax.swing.ProgressMonitorInputStream.

People seem to miss this. Maybe it's because it doesn't start with 'J'. ;-)

Upvotes: 2

barti_ddu
barti_ddu

Reputation: 10309

What UI framework do you use? In case it is Swing, you could wrap your download code into SwingWorker and update progress bar on buffer writes. You could also store written byte count in local variable and utilize Timer, however it seems less elegant (but working).

If my assumption about Swing is correct, wikipedia has good SwingWorker example to help start you with.

Upvotes: 0

Related Questions