title: Creating a timer that shows the time in hh:mm:ss format JavaFX
body: <p>===================================================</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Thanks to <a href="https://stackoverflow.com/users/2423906/sedrick">Sedrick</a> help, I progressed.</p>
  
  <pre><code>public class Main extends Application {
  
      @Override // Override the start method in the Application class
      public void start(Stage primaryStage) {
          FakeCustomNode clockNode = new FakeCustomNode(180);
          Scene scene = new Scene(clockNode, 300, 300);
          primaryStage.setTitle("Timer"); // Set the stage title
          primaryStage.setScene(scene); // Place the scene in the stage
          primaryStage.show(); // Display the stage
          primaryStage.setResizable(false);
      }
  
      /**
       * The main method is only needed for the IDE with limited JavaFX support. Not
       * needed for running from the command line.
       */
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>=======================================================================</p>
  
  <pre><code>final public class FakeCustomNode extends VBox {
  
      TimerGUI stopWatchGUI;
  
      public FakeCustomNode(int minutes) {
          stopWatchGUI = new TimerGUI(minutes);
          getChildren().addAll(stopWatchGUI.getStopWatch());
      }
  }
  </code></pre>
  
  <p>====================================================================</p>
  
  <pre><code>public class TimerGUI {
      Text display;
      Button start;
      Button pause;
      Button reset;
      VBox vbox = new VBox();
  
      int second;
  
  public class TimerGUI {
      Text display;
      VBox vbox = new VBox();
      int second;
  
      public TimerGUI(int time) {
          this.second = time * 60;
          display = new Text(String.format("%02d:%02d:%02d", second / 3600, (second % 3600) / 60, second % 60));
  
          Timeline stopWatchTimeline = new Timeline(new KeyFrame(Duration.seconds(1), (ActionEvent event) -&gt; {
              if (second-- &gt; 0)
                  display.setText(String.format("%02d:%02d:%02d", second / 3600, (second % 3600) / 60, second % 60));
          }));
          stopWatchTimeline.setCycleCount(Timeline.INDEFINITE);
          stopWatchTimeline.play();
  
          vbox.getChildren().addAll(display);
      }
  
      public VBox getStopWatch() {
          return vbox;
      }
  }
  </code></pre>
  
  <p>I don't understand how to change the code so the timer will start on specific action.
  At the moment I ran it, the timer starts.</p>
  
  <p>I want to show <code>03:00:00</code> and after specific action the timer will start.</p>
  
  <p>How can I do that?</p>
  
  <p>Thanks.</p>