java - How can I use existing JProgressBar in SftpProgressMonitor instance? -


I am writing a program that downloads a file to the server using SFTP. I have a progress bar on the program that shows the progress of the download. My current code for the progress monitor is:

  The system class SystemOutProgressMonitor implies SftpProgressMonitor {Public SystemOutProgressMonitor () {}} Public Zero Init (int op, java.lang.String src, java. Lang .stisting distance, long max) {System.out.println ("start:" +++ "+ + + + + + + + +" - & gt; total: + + + + max);} public Bullion count (long bytes) {for (int x = 0; x & lt; byte; x ++) {System.out.println ("#");} return (true);} public zero end () {System .out.println ("\ nFINISHED!");}}  

to output it to the console Works fine for me, however, I do not know how to pass the current progress bar variable.

JProgressBar I My menu. I'm using living in Java class, in this category a download button That is what calls to the related download method in my Sftp.java class, from there, SystemOutProgressMonitor is called to:

  SftpChannel.get (target, destination, new SystemOutProgressMonitor ()) ;  

So do I progress from Menu.java to Sftp.java, and then SystemOutProgressMonitor?

take a look

Otherwise you will see the swingwalker Required or use SwingUtilities.invokeLater to make sure the Event Dispatching Thread is synchronized with updates to JProgressBar .

Take a look at this:

More details


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -