Is there a timer within Java that can be set for a given interval and when the interval has elapsed to send a signal back to the main programme. ?
Something like the way a button reacts when clicked.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Is there a timer within Java that can be set for a given interval and when the interval has elapsed to send a signal back to the main programme. ?
Something like the way a button reacts when clicked.
Take a look at java.util.Timer and javax.swing.Timer, depending on your program's needs.
Hi Greg - Many thanks for reply. I have looked at your suggestions and I am sure I should be able to accomplish what I want to do with one of those.
I reread your question and the phrase, "send a signal back" made me think of an event bus. You might look into that architecture by searching "java eventbus" or "google eventbus".
Hi Greg - Sorry I took so long to reply. You may be pleased to know that I solved my timer problem by using a Handler and a Runnable in my code. It works a treat.