Essentially you are blocking the thread (the Event Dispatching Thread) responsible for painting the updates
You might like to have a read of java timer change delay with button and Does displaying Java GUI requires some special treatment? which shows animation in swing and discusses the importance of the EDT.