I have simple Java Swing application which uses zip4j to encrypt and unpack zip file. It\'s done by this part of code:
ZipFile zipFile = new ZipFile(\"dataStorag
Please read Concurrency in Swing.
What you are doing is using up all resources of the EDT by sleeping and updating, not leaving any time for it to actually redraw your GUI. The EDT is meant for small operations on the GUI. You should never call Thread.sleep()
on the EDT.
What you could do is make a Timer
that would run your check every second until the check passes. That way the EDT would be free to not freeze.
A much better way of doing this is by using a SwingWorker
. It has methods that do your specific thing: