Comparing javax.swing.Timer, java.util.Timer and Thread, which method is the best CPU utilization for animation in Java and why ? The other method that not mentioned is also accepted.
Comparing javax.swing.Timer , java.util.Timer and Thread , which method is the best CPU utilization
Share
When working with GUI components you should always use
javax.swing.Timerfor animations.The swing timer will help you execute your animation tasks on the correct thread. (The Event Dispatch Thread, or EDT)
To answer your specific question:
If used correctly, neither will affect CPU performance in a positive or negative way. They will essentially provide the exact same functionality.