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).
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package seng302.Controllers;
|
package seng302.Controllers;
|
||||||
|
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
@@ -118,7 +119,14 @@ public class RaceController extends Controller {
|
|||||||
|
|
||||||
//Initialize save annotation array, fps listener, and annotation listeners
|
//Initialize save annotation array, fps listener, and annotation listeners
|
||||||
timeZone.setText(raceClock.getTimeZone());
|
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();
|
initializeFPS();
|
||||||
initializeAnnotations();
|
initializeAnnotations();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user