Java Code Examples for javafx.scene.control.Slider#setMinorTickCount()

The following examples show how to use javafx.scene.control.Slider#setMinorTickCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentZoomPane.java    From JavaFXSmartGraph with MIT License 6 votes vote down vote up
private Node createSlider() {

        Slider slider = new Slider(MIN_SCALE, MAX_SCALE, MIN_SCALE);
        slider.setOrientation(Orientation.VERTICAL);
        slider.setShowTickMarks(true);
        slider.setShowTickLabels(true);
        slider.setMajorTickUnit(SCROLL_DELTA);
        slider.setMinorTickCount(1);
        slider.setBlockIncrement(0.125f);
        slider.setSnapToTicks(true);

        Text label = new Text("Zoom");

        VBox paneSlider = new VBox(slider, label);

        paneSlider.setPadding(new Insets(10, 10, 10, 10));
        paneSlider.setSpacing(10);

        slider.valueProperty().bind(this.scaleFactorProperty());

        return paneSlider;
    }
 
Example 2
Source File: ColorPicker.java    From mcaselector with MIT License 5 votes vote down vote up
private Slider createSlider(int min, int max, int steps, int init) {
	Slider slider = new Slider(min, max, init);
	slider.setMajorTickUnit(steps);
	slider.setMinorTickCount(0);
	slider.setBlockIncrement(steps);
	return slider;
}
 
Example 3
Source File: SliderSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SliderSample() {
    VBox root = new VBox();
    Slider slider = new Slider();
    slider.setMin(0);
    slider.setMax(100);
    slider.setValue(40);
    slider.setShowTickLabels(true);
    slider.setShowTickMarks(true);
    slider.setMajorTickUnit(50);
    slider.setMinorTickCount(5);
    slider.setBlockIncrement(10);
    root.getChildren().addAll(slider, new Button("Click me!!"));
    getChildren().add(root);
}
 
Example 4
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SliderEditor(Option<Number> option, int min, int max) {
    slider = new Slider(min, max, option.valueProperty().getValue().doubleValue());
    slider.setSnapToTicks(true);
    slider.setMajorTickUnit(1);
    slider.setMinorTickCount(0);
    valueProperty().bindBidirectional(option.valueProperty());
}
 
Example 5
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SliderEditor(Option<Number> option, int min, int max) {
    slider = new Slider(min, max, option.valueProperty().getValue().doubleValue());
    slider.setSnapToTicks(true);
    slider.setMajorTickUnit(1);
    slider.setMinorTickCount(0);
    valueProperty().bindBidirectional(option.valueProperty());
}
 
Example 6
Source File: SettingsPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SliderEditor(Option<Number> option, int min, int max) {
    slider = new Slider(min, max, option.valueProperty().getValue().doubleValue());
    slider.setSnapToTicks(true);
    slider.setMajorTickUnit(1);
    slider.setMinorTickCount(0);
    valueProperty().bindBidirectional(option.valueProperty());
}
 
Example 7
Source File: View.java    From SynchronizeFX with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Create an instance of the View.
 */
public View() {
    setSpacing(20);
    setPadding(new Insets(20));

    final Text header = new Text("SynchronizeFX Example");
    header.setFill(Color.DIMGRAY);
    header.setStyle("-fx-font-size:24");

    slider = new Slider();
    slider.setMin(0);
    slider.setMax(100);
    slider.setShowTickLabels(true);
    slider.setShowTickMarks(true);
    slider.setMajorTickUnit(20);
    slider.setMinorTickCount(5);
    slider.setSnapToTicks(true);


    final Label valueLabel = new Label();
    valueLabel.setTextFill(Color.DIMGRAY);
    valueLabel.setStyle("-fx-font-size:15");

    valueLabel.textProperty()
            .bind(Bindings.format("Current Value: %1$.1f",
                    slider.valueProperty()));

    getChildren().addAll(header, slider, valueLabel);
}