Reputation: 739
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
Reputation: 311050
See javax.swing.ProgressMonitorInputStream.
People seem to miss this. Maybe it's because it doesn't start with 'J'. ;-)
Upvotes: 2
Reputation: 8139
See http://www.java-forums.org/awt-swing/15152-swingworker-my-small-internet-page-downloader.html
Upvotes: 0
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