-1

I Have a Java FXML Project. It has a Slider from 1 to 10 with steps of 1. I have a Label.

enter image description here

Slider = sl_test

Label = txt_test

I want the the Label to update on every change of the Slider to display the current Value (which i know, i can get with sl_test.getValue()).

Steffen Bauer
  • 145
  • 1
  • 10
  • 2
    `label.textProperty().bind(slider.valueProperty().asString())`..? – Slaw Jul 11 '18 at 08:54
  • 1
    [Using JavaFX UI Controls: Slider](https://docs.oracle.com/javafx/2/ui_controls/slider.htm) has an example; [JavaFX 8 Event Handling Examples](http://code.makery.ch/blog/javafx-8-event-handling-examples/) would probably also help and [Slider value property change listener](http://www.java2s.com/Code/Java/JavaFX/Slidervaluepropertychangelistener.htm) certainly couldn't hurt – MadProgrammer Jul 11 '18 at 08:54

1 Answers1

1

thanks to the comment from @Slaw i got it

@Override
public void initialize(URL url, ResourceBundle rb) {
    txt_test.textProperty().bind(sl_test.valueProperty().asString());
}   
Steffen Bauer
  • 145
  • 1
  • 10