Results 1 to 4 of 4
  1. #1
    kd0jzi is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default New to Java need help with a timer

    Hello guys and gals, I'm new to Java and programing language so a little slow on figuring things out.

    What I'm trying to make is a countdown timer for Ham Radio Operators to use in a internet toolbar.
    It would have the option to countdown from 10 minutes or 60 minutes, then display a message reminding them to state their call sign. It would then reset automaticly, and start over once more. Also if possible it could play a tone, or sound as an alert. If it's hidden in the background under another app, it would popup to the top window.
    Any help would be apreciated.
    Thanks in advance.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You have stated what you want to do, and that's good, but based on that, it's kind of hard to give you specific recommendations until we know what you've done so far, and what your current specific road blocks are. Til we hear about them, are you familiar with the Sun Java tutorials? They are a god-send and can help you learn many of the most important aspects of the Java programming language, and you can find them here: The Big Index

    Oh, and welcome to the forum, and best of luck with your project!

  3. #3
    kd0jzi is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    Here's a script I had found for the idea I had. I would rewrite it for the time limit as needed. And edit the popup text...I at least know how to do that much.

    <SCRIPT LANGUAGE = "JavaScript">
    <!--
    var secs
    var timerID = null
    var timerRunning = false
    var delay = 1000

    function InitializeTimer()
    {
    // Set the length of the timer, in seconds
    secs = 10
    StopTheClock()
    StartTheTimer()
    }

    function StopTheClock()
    {
    if(timerRunning)
    clearTimeout(timerID)
    timerRunning = false
    }

    function StartTheTimer()
    {
    if (secs==0)
    {
    StopTheClock()
    // Here's where you put something useful that's
    // supposed to happen after the allotted time.
    // For example, you could display a message:
    alert("You have just wasted 10 seconds of your life.")
    }
    else
    {
    self.status = secs
    secs = secs - 1
    timerRunning = true
    timerID = self.setTimeout("StartTheTimer()", delay)
    }
    }
    //-->
    </SCRIPT>


    What I want to do is have it automaticly reset and start to countdown all over from the set time, when you click the ok button on the pop up message. That way you don't have to keep clicking "start timer"

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Ah, we've got a big problem here as you're asking a JavaScript question, and this is a Java forum. Please understand that the two programming languages aren't even related except that they both share a C-like syntax and share a similar name (simply due to a marketing ploy by the JavaScript people).

    You really will need to ask this question in a JavaScript forum. Google will help you find one.

    Much luck!

Similar Threads

  1. Java Timer
    By sasi25 in forum Advanced Java
    Replies: 4
    Last Post: 01-30-2010, 09:19 AM
  2. Timer in java
    By manhit45 in forum New To Java
    Replies: 4
    Last Post: 12-14-2009, 02:27 PM
  3. Replies: 0
    Last Post: 04-04-2008, 02:46 PM
  4. Help with timer in java
    By barney in forum Advanced Java
    Replies: 1
    Last Post: 08-01-2007, 10:24 AM
  5. Problem with timer in java
    By paul in forum Advanced Java
    Replies: 3
    Last Post: 07-26-2007, 10:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •