A slider with customized tick marks and tick mark labels, which also spans from 0 to 1
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Slider;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setTitle("Slider Sample");
Slider slider = new Slider(0, 1, 0.5);
slider.setShowTickMarks(true);
slider.setShowTickLabels(true);
slider.setMajorTickUnit(0.25f);
slider.setBlockIncrement(0.1f);
root.getChildren().add(slider);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Related examples in the same category