How to change a Slider value from a different control event listener in JavaFX?

StackOverflow https://stackoverflow.com/questions/23505841

  •  16-07-2023
  •  | 
  •  

سؤال

Say I have a javafx.scene.control.Slider slider and javafx.scene.control.Button button. What should I write in the button event handler to change the slider value programmatically on the button click?

هل كانت مفيدة؟

المحلول

Call setValue with value between min and max of your slider (0 and 1 by default) http://docs.oracle.com/javafx/2/api/javafx/scene/control/Slider.html#setValue(double)

slider.setValue(0.5);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top