The GUI needs to be updated on the EDT to ensure that the painting is done correctly. Read the section in the Swing Concurrency Guide for a full explanation of this concept.
When you use the Swing timer, the event is executed in EDT, so you can simply tell the component to repaint itself to a new location.
When you use Thread, the loop executes with EDT, and you need to use SwingUtilities.invokeLater (...) to return the drawing code to EDT.
In general, if you code simply moves a component from one place to another, then probably the easiest way to use a timer. However, if you play with a lot of complex logic, then you do not want this logic to run on EDT, as it will not allow the graphical interface to respond to events and repaint itself. In this case, you can use Thread.
source share