Code from any listener executes on the Event Dispatch
Thread (EDT). All Swing painting is done on the EDT. If you tell the EDT to sleep (for one second), then the EDT cant paint the changes. So the only painting that is done is the last iteration of your loop.
If you want to do animation of some kind then
you should be using a Swing Timer to schedule an event to happen every second. Then you will see the painting done each second.