I am working on a project that transfers files over a network and I want to incorporate a JProgressBar
to show the progress during file transfer but I need help on that.
You probably would find a ProgressMonitorInputStream easiest, but if that doesn't do enough for you, look at its source code to get exactly what you want.
InputStream in = new BufferedInputStream(
new ProgressMonitorInputStream(
parentComponent,
"Reading " + fileName,
new FileInputStream(fileName)
)
);
To use a different transfer method then substitute an appropriate stream for FileInputStream.