JProgressBar working according to application load in swing

105 views Asked by At

I want to develop small project for file copy application in java swing. I want to show progress bar for that, means how much percent data is been copy.. so can any body tell me idea how to develop it

1

There are 1 answers

2
dARKpRINCE On BEST ANSWER

Sure thing. Here is an idea: When you copy files use InputStream and read a standard size of bytes, say 1024 bytes, and copy it to the new file. Each time you read the file, your progress is

(1024 bytes * NumberOfReads)/SizeOfFileInBytes