From 81ed07330bb453d989a88903181f512ee430279f Mon Sep 17 00:00:00 2001 From: fjc40 Date: Fri, 19 May 2017 21:50:14 +1200 Subject: [PATCH] Fixed the bug where the race clock wasn't visible some of the time. It appears to have been due to a threading/javaFX thread issue with prop1.bind(prop2). --- .../main/java/seng302/Controllers/RaceController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/visualiser/src/main/java/seng302/Controllers/RaceController.java b/visualiser/src/main/java/seng302/Controllers/RaceController.java index 106a0089..5781f9e7 100644 --- a/visualiser/src/main/java/seng302/Controllers/RaceController.java +++ b/visualiser/src/main/java/seng302/Controllers/RaceController.java @@ -1,6 +1,7 @@ package seng302.Controllers; +import javafx.application.Platform; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.*; @@ -118,7 +119,14 @@ public class RaceController extends Controller { //Initialize save annotation array, fps listener, and annotation listeners timeZone.setText(raceClock.getTimeZone()); - timer.textProperty().bind(raceClock.durationProperty()); + + //RaceClock.duration isn't necessarily being changed in the javaFX thread, so we need to runlater the update. + raceClock.durationProperty().addListener((observable, oldValue, newValue) -> { + Platform.runLater(() -> { + timer.setText(newValue); + }); + }); + initializeFPS(); initializeAnnotations();