Creates a slider who's range, or span, goes from 0 to 1, and who's value defaults to .5: : Slider « JavaFX « Java






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

1.Using CustomMenuItem to add Slider to MenuItem
2.balance, rate, volume Slider;
3.Slider value property change listener
4.A slider with customized tick marks and tick mark labels, which also spans from 0 to 1