import java.awt.Component;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.I
Here you can find same example. Making Progress With Swing's Progress Monitoring API.
I can think of two ways.
Start by wrapping you copy code into a SwingWorker, using the setProgress
method to update the progress and a property change listener to monitor changes to the progress property.
When the progress property changes, you would then update the UI.
This solution will require you to supply you own UI
Use a ProgressMonitorInputStream, which comes with it's own UI.
InputStream in = new BufferedInputStream(
new ProgressMonitorInputStream(
parentComponent,
"Reading " + fileName,
new FileInputStream(fileName)));
(Example stolen from Java Docs)