url - How to add progressbar to display download status in Java? -


I am using an external library to download files from mega but to display the user's download time Requires a progress bar. I've read articles related to a lot of progress bars on stack overflow but the problem is that I do not know how long it takes in my code to add a progress bar.

How do I add the progress bar to display the download status?

  Try {URLConnection urlConn = new URL (file_url) .openConnection (); Print (FILE_URL); Is = urlConn.getInputStream (); While ((read = is.read (buffer)) gt; 0) {cos.write (buffer, 0, reading); }} Finally {try {cos.close ()} if (is! = Null) {is}. }} Finally {if (fos! = Null) {fos.close (); }}} Print ("Download Finished"); }    

You can create a progress bar dialog and show it actively , And then your swingworker . Swing Worker is a type of movable object (it will be executed behind your main thread)) and especially graphic elements ( publish their To update the changes) is visualized, because it works.

Take a look at this stackover flow question:



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -