Note that there are some explanatory texts on larger screens.

plurals
  1. PORecurring Countdown Timer in Java
    primarykey
    data
    text
    <p>I'm trying to implement a countdown timer into a pre-existing public class and I have a few questions.</p> <p>An overview: I want to have a timer within a program that counts down from 60 (seconds) once the program is initialized. </p> <p>If the timer reaches zero, the program quits. </p> <p>If the user meets certain parameters within the 60 second time frame, the timer resets to 60, presents a new set of parameters, and begins the countdown again. It should be able to do this an infinite number of times, until the user fails to meet parameters within 60 seconds.</p> <p>There will also be some sort of (TBD) GUI representation of the timer, most likely either numerical countdown or JProgressBar.</p> <p>I'm semi-new (~3 months) to programming, self-taught, and still learning lots (so be gentle) :)</p> <p>My questions are:</p> <ol> <li><p>What is the best way to implement this?</p></li> <li><p>I'm assuming this needs to run in a thread?</p></li> <li><p>Will the timer be easily configurable? (not important, just interesting)</p></li> </ol> <p>Thanks for your help. If you need to see code, I can find some.</p> <p>EDIT: Just for some clarification/context: This is for a timed racing video game I'm working on to develop my skills as a programmer. The idea is that a player has 60 seconds to complete a lap. If the player completes a successful lap, the timer resets to 60 seconds and the track changes to be slightly more difficult. The game runs until the player is unable to complete a lap in 60 seconds due to the difficulty. The game records the number of laps as a high score, and asks to player if they would like to try again. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload