/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test; import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.Scene; import javafx.scene.control.Slider; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.StageStyle; /** * * @author Pedro */ public class SliderTest extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Slider isValueChanging is wrong"); StackPane root = new StackPane(); final Slider slider = new Slider(); // slider.setSnapToTicks(true); slider.valueProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue arg0, Number arg1, Number newValue) { if (!slider.isValueChanging()) { System.out.println("Slider value STOPPED changing. Current value = " + newValue); } else { System.out.println("Slider value CHANGING = " + newValue + " valueChanging =" + slider.valueChangingProperty().get()); } } }); root.getChildren().add(slider); Scene scene = new Scene(root, 300, 250); primaryStage.setScene(scene); primaryStage.show(); } }