Forums Register Login

SimpleTimer ActionListener Question

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Sorry, yes I am referring to the Timer class. SimpleTimer is what I named my class which was copied from a tutorial.
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 376 times.
Similar Threads
my java project.
ActionListeners in Separate Class/File
button problem
Adding a delay in a java app
Event driven programming
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:49:17.