I'm starting with Jframe
and GUI
stuff in Java and I want to make progress bar when program deleting files/folders.
I wish I could make progress bar with % progress. When it start it'll be 0% and during deleting it'll goes to 100%. Any ideas how to do that? In some easy way?
The simplest way to do it would be to:
1)write a method to count all folders and files you want to delete, you may have to call this method recursively where you have multiple nested folders and files.
2)Set the maximum progress bar to this value via the setMaximum method.
3)Set the minimum to 0 via the progress bar setMinimum method.
4)Set "stringPainted" to true to actually display progress percentage.
5)Finally (recursively if necessary) delete each file updating your progress bar via the setValue method.