Swing repaint() doesn’t work in loop or thread
Your while (true) is blocking the Swing event thread putting the application to sleep. For simple animation and game loop, use a Swing Timer. If you have long running code that needs to be in the background, then use a background thread such as a SwingWorker, but taking care to make sure that all calls … Read more