title: Periodically refresh data
body: <p>I want to display data periodically but I get error when I try to display the data.</p>
  
  <pre><code>Timeline fiveSecondsWonder = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler&lt;ActionEvent&gt;() {
  @Override
  public void handle(ActionEvent event) {
  
          GridPane gp = new GridPane();
  
          gp.setPadding(new Insets(10, 10, 10, 10));
          gp.setHgap(20);
          gp.setVgap(10);
          //gp.setGridLinesVisible(true);
  
          gp.add(new Label("Operating System Name"), 0, 0);
          gp.add(new Label(System.getProperty("os.name")), 1, 0);
  
          gp.add(new Label("Operating System Version"), 0, 1);        
          gp.add(new Label(System.getProperty("os.version")), 1, 1);
  
          gp.add(new Label("System Architecture"), 0, 2);        
          gp.add(new Label(System.getProperty("os.arch")), 1, 2);
  
          gp.add(new Label("Total Memory"), 0, 3);
          String memStrLong = Long.toString(Runtime.getRuntime().totalMemory());
          gp.add(new Label(memStrLong), 1, 3);
  
          gp.add(new Label("Used Memory"), 0, 4);
          String fStrLong = Long.toString(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
          gp.add(new Label(fStrLong), 1, 4);
  
          gp.add(new Label("Java Version"), 0, 5);        
          gp.add(new Label(System.getProperty("java.version")), 1, 5);
  
          gp.add(new Label("Number of Processors"), 0, 6);       
          String pStrLong = Long.toString(Runtime.getRuntime().availableProcessors());
          gp.add(new Label(pStrLong), 1, 6);
  
          gp.add(new Label("Maximum available Memory"), 0, 7);       
          String amStrLong = Long.toString(Runtime.getRuntime().maxMemory());
          gp.add(new Label(amStrLong), 1, 7);
  
      }
  }));
  fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE);
  fiveSecondsWonder.play();
  
  Vbox.getChildren().add(gp);
  </code></pre>
  
  <p>Can you help me to implement properly this example, please?</p>
  
  <p>EDIT: Second test:</p>
  
  <pre><code>ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {  
              @Override  
              public Thread newThread(Runnable r) {  
                  Thread thread = new Thread(r);  
                  thread.setDaemon(true);  
                  return thread;  
              }  
          });  
          scheduledExecutorService.scheduleAtFixedRate(new Runnable() {  
  
              final GridPane gp = new GridPane();
  
              @Override  
              public void run() {  
  
                      gp.getChildren().clear();
  
                      gp.setPadding(new Insets(10, 10, 10, 10));
                      gp.setHgap(20);
                      gp.setVgap(10);
                      //gp.setGridLinesVisible(true);
  
                      gp.add(new Label("Operating System Name"), 0, 0);
                      gp.add(new Label(System.getProperty("os.name")), 1, 0);
  
                      gp.add(new Label("Operating System Version"), 0, 1);        
                      gp.add(new Label(System.getProperty("os.version")), 1, 1);
  
                      gp.add(new Label("System Architecture"), 0, 2);        
                      gp.add(new Label(System.getProperty("os.arch")), 1, 2);
  
                      gp.add(new Label("Total Memory"), 0, 3);
                      String memStrLong = Long.toString(Runtime.getRuntime().totalMemory());
                      gp.add(new Label(memStrLong), 1, 3);
  
                      gp.add(new Label("Used Memory"), 0, 4);
                      String fStrLong = Long.toString(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
                      gp.add(new Label(fStrLong), 1, 4);
  
                      gp.add(new Label("Java Version"), 0, 5);        
                      gp.add(new Label(System.getProperty("java.version")), 1, 5);
  
                      gp.add(new Label("Number of Processors"), 0, 6);       
                      String pStrLong = Long.toString(Runtime.getRuntime().availableProcessors());
                      gp.add(new Label(pStrLong), 1, 6);
  
                      gp.add(new Label("Maximum available Memory"), 0, 7);       
                      String amStrLong = Long.toString(Runtime.getRuntime().maxMemory());
                      gp.add(new Label(amStrLong), 1, 7);
  
                      vb.getChildren().add(gp);
  
              }  
          }, 0, 1, TimeUnit.SECONDS);
  </code></pre>
  
  <p>I also tested this but with the data is not updated.</p>