Thread.Sleep() is freezing
Solution 1:
Don't ever call Thread.sleep(...) from within the Swing event thread as this will put the event thread itself to sleep. Since this thread is responsible for all Swing painting and user interaction, this will put your application to sleep.
If all you want is a delay in the display, then consider use of a Swing Timer.
If on the other hand your event thread is being compromised by a long-running task, then do the task in the background, using a SwingWorker (as suggested by Guillaume 1+ to him).
Solution 2:
You are calling sleep
on the EDT (Event Dispatching Thread). You should avoid this situation as indeed, it freezes the UI.
To avoid this situation, use a SwingWorker instead or as suggested by HFOE, use a Swing Timer