Creates a slider who's range, or span, goes from 0 to 1, and who's value defaults to .5:
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);
root.getChildren().add(slider);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Related examples in the same category