Looking at the docs I see you don't need to pass a ChangeListener
but simply an anonymous function with the same signature as the onChange
method
speedSlider.valueProperty.addListener{ (o: javafx.beans.value.ObservableValue[_ <: Number], oldVal: Number, newVal: Number) =>
speed = newVal.intValue
}
Otherwise the method will expect a javafx.beans.value.ChangeListener
I hope this solves the issue.