I'm trying to display the value of my slider when I am moving it around.
This is what I've tried so far but doesn't work:
public class ControlsController extends BaseController{
@FXML
private Slider slAcceleration;
@FXML
public void slAccelerationEventHandler(DragEvent event){
System.out.println(slAcceleration.getValue());
}
}
And my .fxml
code:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Slider?>
<?import javafx.scene.layout.Pane?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="250.0" prefWidth="300.0" style="-fx-background-color: bdc3ff;" xmlns="http://javafx.com/javafx/8.0.102" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.ControlsController">
<children>
<Label id="lbAcceleration" layoutX="14.0" layoutY="125.0" text="Versnelling simulatie x60" />
<Slider id="slAcceleration" blockIncrement="1.0" layoutX="14.0" layoutY="151.0" max="600.0" min="1.0" onDragDone="#slAccelerationEventHandler" prefHeight="14.0" prefWidth="280.0" value="60.0" />
</children>
</Pane>
Let me know if I should post more information. Any help would be greatly appriciated!