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.

Results 1 to 5 of 5

Thread: Does Java have a timer routine.

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Does Java have a timer routine.

    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.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Does Java have a timer routine.

    Take a look at java.util.Timer and javax.swing.Timer, depending on your program's needs.

  3. #3
    Junior Member
    Join Date
    May 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Does Java have a timer routine.

    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.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Does Java have a timer routine.

    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".

  5. #5
    Junior Member
    Join Date
    May 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Does Java have a timer routine.

    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.

Similar Threads

  1. Screen item not appearing when routine called
    By DenPit5 in forum Android Development
    Replies: 5
    Last Post: May 27th, 2014, 11:11 AM
  2. Screen item not appearing when routine called
    By DenPit5 in forum Java Theory & Questions
    Replies: 1
    Last Post: May 27th, 2014, 02:11 AM
  3. [SOLVED] both class javax.swing.Timer in javax.swing and class java.util.Timer in java.util match
    By stresstedout in forum What's Wrong With My Code?
    Replies: 13
    Last Post: April 10th, 2014, 07:32 PM
  4. I Cant seem to get my sort routine to function
    By rrickman9 in forum What's Wrong With My Code?
    Replies: 15
    Last Post: May 22nd, 2011, 07:48 PM
  5. How to Use Timer in Java
    By neo_2010 in forum Java Programming Tutorials
    Replies: 0
    Last Post: September 1st, 2009, 12:10 PM