Displaying changing values in JavaFx Label

There are numerous ways to achieve that, the most convenient would be to use JavaFX’s DataBinding mechanism:

// assuming you have defined a StringProperty called "valueProperty"
Label myLabel = new Label("Start");
myLabel.textProperty().bind(valueProperty);

This way, every time your valueProperty gets changed by calling it’s set method, the label’s text is updated.

Leave a Comment