• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the Difference between {java.util.Timer} and {javax.swing.Timer}?  RSS feed

 
Kevin Simonson
Ranch Hand
Posts: 198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the Difference between {java.util.Timer} and {javax.swing.Timer}? If I want to draw to a {JPanel} object every hundred milliseconds or so, changing it slightly, and therefore want to use one of these two classes, is there a reason I should prefer one over the other?

Kevin S
 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code from a Swing Timer is executed on the Event Dispatch Thread. All Swing components should be updated from the EDT.

Read the section from the Swing tutorial on Concurrency for more information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!