• Post Reply Bookmark Topic Watch Topic
  • New Topic

SimpleTimer ActionListener Question  RSS feed

 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have a SimpleTimer set to trigger an ActionListener every 'n' seconds. What happens if the ActionPerformed takes longer than 'n' seconds? Does another ActionPerformed trigger anyway (asynchronous multiple actions) or will the next ActionPerformed trigger 'n' seconds after the previous one ends? I'm trying to figure out if I need to stop the timer in the ActionPerformed method (if that is possible) and restart it when it exits or if I can just let it go expecting single threaded synchronous operation. TIA.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is discussed in the java.util.Timer class's API doc. Take a look: http://docs.oracle.com/javase/8/docs/api/index.html
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. That was the first place I looked but I did not see where it specifically discussed my question. I'll look more closely. Perhaps I did not understand what it was telling me.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is SimpleTimer a standard Java® class? I presume you mean javax.swing.Timer? You can also read about that here. There are three classes called Timer in the standard API; this one is commonly used too.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, yes I am referring to the Timer class. SimpleTimer is what I named my class which was copied from a tutorial.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!