Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. How to write a Timer program in java

How to write a Timer program in java

Scheduled Pinned Locked Moved Java
javadatabasetutorial
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VickyVicki
    wrote on last edited by
    #1

    Hi Friends, I would like to know , how to write a timer program.For eg the application should trigger after a particular time.Thanks in Advance :)

    L T D 3 Replies Last reply
    0
    • V VickyVicki

      Hi Friends, I would like to know , how to write a timer program.For eg the application should trigger after a particular time.Thanks in Advance :)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      VickyVicki wrote:

      the application should trigger after a particular time.

      Trigger what? Do you mean that it should run doing nothing until a certain time of day or until a certain time interval has elapsed? In either case a quick look at the Java documentation for something to do with Date[^]s or times should help.

      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

      1 Reply Last reply
      0
      • V VickyVicki

        Hi Friends, I would like to know , how to write a timer program.For eg the application should trigger after a particular time.Thanks in Advance :)

        T Offline
        T Offline
        TorstenH
        wrote on last edited by
        #3

        Don't believe Richard, for him time is something that is flying by :laugh: ;P GregorianCalendar [^]is so much better! Combine it with This one about running System Commands[^]. The rest is up to you - that is what development is about. Make a plan, write things down, sketch a GUI and afterwards start implementing what you've written down.

        regards Torsten When I'm not working

        L 1 Reply Last reply
        0
        • V VickyVicki

          Hi Friends, I would like to know , how to write a timer program.For eg the application should trigger after a particular time.Thanks in Advance :)

          D Offline
          D Offline
          David Skelly
          wrote on last edited by
          #4

          Well, you could use the Java Timer class: http://docs.oracle.com/javase/6/docs/api/java/util/Timer.html[^] Or if your requirements are more complicated, try something like Quartz: http://quartz-scheduler.org/[^]

          V 1 Reply Last reply
          0
          • T TorstenH

            Don't believe Richard, for him time is something that is flying by :laugh: ;P GregorianCalendar [^]is so much better! Combine it with This one about running System Commands[^]. The rest is up to you - that is what development is about. Make a plan, write things down, sketch a GUI and afterwards start implementing what you've written down.

            regards Torsten When I'm not working

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            TorstenH. wrote:

            time is something that is flying by

            Faster every year! :((

            TorstenH. wrote:

            GregorianCalendar

            I can never remember this class, even though it's obvious.

            Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

            N 1 Reply Last reply
            0
            • D David Skelly

              Well, you could use the Java Timer class: http://docs.oracle.com/javase/6/docs/api/java/util/Timer.html[^] Or if your requirements are more complicated, try something like Quartz: http://quartz-scheduler.org/[^]

              V Offline
              V Offline
              VickyVicki
              wrote on last edited by
              #6

              Thanks for all your replies. :) I wanted something like an quiz system .After the particular time getsover the application should stop and also should start after a specific min

              N 1 Reply Last reply
              0
              • V VickyVicki

                Thanks for all your replies. :) I wanted something like an quiz system .After the particular time getsover the application should stop and also should start after a specific min

                N Offline
                N Offline
                Nagy Vilmos
                wrote on last edited by
                #7

                If you need to measure an elapsed time, a simple Thread with a sleep or wait in it may be sufficient.


                Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                1 Reply Last reply
                0
                • L Lost User

                  TorstenH. wrote:

                  time is something that is flying by

                  Faster every year! :((

                  TorstenH. wrote:

                  GregorianCalendar

                  I can never remember this class, even though it's obvious.

                  Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                  N Offline
                  N Offline
                  Nagy Vilmos
                  wrote on last edited by
                  #8

                  Richard MacCutchan wrote:

                  Faster every year

                  As they sang in Trumpton[^]: [sing] Time flies by when you're a driver of a train, Speeding out of Trumpton with a cargo of cocaine. I get high when im a pilot of a plane. Touching down in Camberwick, I'm stoned out of my brain. [/sing]


                  Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                  L 1 Reply Last reply
                  0
                  • N Nagy Vilmos

                    Richard MacCutchan wrote:

                    Faster every year

                    As they sang in Trumpton[^]: [sing] Time flies by when you're a driver of a train, Speeding out of Trumpton with a cargo of cocaine. I get high when im a pilot of a plane. Touching down in Camberwick, I'm stoned out of my brain. [/sing]


                    Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    I never really watched Trumpton, but my children used to love it.

                    Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups