It is necessary to make a timer like HH: MM: SS on Java countdown according to this principle of operation:

  1. The user enters the duration of the timer (in seconds);
  2. After pressing the button, the timer starts counting down, its operation is displayed;
  3. When time expires, the timer displays "TIME OVER";

Prompt the implementation of this timer.

Below is an example: timer operation example

Closed due to the fact that off-topic participants Denis , aleksandr barakin , fori1ton , iluxa1810 , Kromster 17 Nov '16 at 5:00 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - aleksandr barakin, fori1ton, iluxa1810, Kromster
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    Show your achievements, otherwise it will work for you, what they don’t do here. - Denis

1 answer 1

//start thread () -> { updateBar(timeExpired) if (timeExpired == 0) scheduler.cancel(true); //cancel tread scheduler = null; }, 1000, 1000); //schedule at fixed rate 

I think you can describe further logic.