Created
March 3, 2016 14:39
-
-
Save dhust/c6347487fe0c5b5cd5a6 to your computer and use it in GitHub Desktop.
Slider - event handling. One way to do it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FXMLDocumentController implements Initializable { | |
// Needs to have @FXML otherwise you'll get errors and your program will not run | |
@FXML private Slider mySlider; | |
@Override | |
public void initialize(URL url, ResourceBundle rb) { | |
// You have three different variables available | |
// I used newValue which is the sliders value after it is moved | |
// You can also use observable and oldValue | |
mySlider.valueProperty().addListener((observable, oldValue, newValue) -> { | |
System.out.println("Slider Value Changed (newValue: " + newValue.intValue() + ")"); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment