Java Code Examples for javafx.scene.control.Slider#setShowTickLabels()
The following examples show how to use
javafx.scene.control.Slider#setShowTickLabels() .
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 |
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: DoubleSliderControl.java From PreferencesFX with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); fieldLabel = new Label(field.labelProperty().getValue()); valueLabel = new Label(String.valueOf(field.getValue().doubleValue())); slider = new Slider(); slider.setMin(min); slider.setMax(max); slider.setShowTickLabels(false); slider.setShowTickMarks(false); slider.setValue(field.getValue()); node = new HBox(); node.getStyleClass().add("double-slider-control"); }
Example 3
Source File: IntegerSliderControl.java From PreferencesFX with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); fieldLabel = new Label(field.labelProperty().getValue()); valueLabel = new Label(String.valueOf(field.getValue().intValue())); slider = new Slider(); slider.setMin(min); slider.setMax(max); slider.setShowTickLabels(false); slider.setShowTickMarks(false); slider.setValue(field.getValue()); node = new HBox(); node.getStyleClass().add("integer-slider-control"); }
Example 4
Source File: PercentSliderControl.java From Quelea with GNU General Public License v3.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); fieldLabel = new Label(field.labelProperty().getValue()); valueLabel = new Label((int) (100 * field.getValue()) + "%"); slider = new Slider(); slider.setMin(min); slider.setMax(max); slider.setShowTickLabels(false); slider.setShowTickMarks(false); slider.setValue(field.getValue()); node = new HBox(); node.getStyleClass().add("double-slider-control"); }
Example 5
Source File: SliderSample.java From marathonv5 with Apache License 2.0 | 5 votes |
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 6
Source File: YOLOApp.java From java-ml-projects with Apache License 2.0 | 5 votes |
private HBox buildBottomPane() { sldThreshold = new Slider(0.1f, 1.0f, DEFAULT_THRESHOLD); sldThreshold.setShowTickLabels(true); sldThreshold.setMajorTickUnit(0.1); sldThreshold.setBlockIncrement(0.01); sldThreshold.setShowTickMarks(true); sldThreshold.valueProperty().addListener(v -> update()); MenuButton mbLoadImage = new MenuButton("Load Image"); MenuItem mnLocalImage = new MenuItem("From Computer"); mbLoadImage.getItems().add(mnLocalImage); MenuItem mnUrl = new MenuItem("Enter URL"); mnUrl.setOnAction(e -> { Optional<String> imgUrl = AppUtils.askInputFromUser("Enter an URL", "Enter an image URL:"); AppUtils.doBlockingAsyncWork(scene, () -> { imgUrl.ifPresent(this::checkAndLoadImage); }); }); mnLocalImage.setOnAction(e -> { FileChooser fc = new FileChooser(); fc.getExtensionFilters().add(new ExtensionFilter("PNG Files", "*.png")); fc.getExtensionFilters().add(new ExtensionFilter("JPG Files", "*.jpg")); File selectedFile = fc.showOpenDialog(sldThreshold.getScene().getWindow()); if (selectedFile != null) { checkAndLoadImage(selectedFile); } }); mbLoadImage.getItems().add(mnUrl); HBox hbBottom = new HBox(10, new Label("Threshold: "), sldThreshold, mbLoadImage); hbBottom.setAlignment(Pos.CENTER); return hbBottom; }
Example 7
Source File: View.java From SynchronizeFX with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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); }
Example 8
Source File: SliderDemo.java From phoebus with Eclipse Public License 1.0 | 4 votes |
@Override public void start(final Stage stage) { final Slider slider = new Slider(); slider.setOrientation(Orientation.HORIZONTAL); slider.setShowTickLabels(true); slider.setShowTickMarks(true); slider.setMajorTickUnit(20.0); slider.setMin(-100.0); slider.setMax(100.0); slider.setValue(10.0); slider.valueProperty().addListener((observable, old, value)-> { System.out.println("Value: " + value); }); final SliderMarkers markers = new SliderMarkers(slider); markers.setAlarmMarkers(-100, -10, 70, 90); final String font = "-fx-font-size: 30px"; slider.setStyle(font); markers.setStyle(font); final GridPane layout = new GridPane(); layout.add(markers, 0, 0); layout.getChildren().add(slider); if (slider.getOrientation() == Orientation.VERTICAL) { GridPane.setConstraints(slider, 1, 0); GridPane.setVgrow(slider, Priority.ALWAYS); } else { GridPane.setConstraints(slider, 0, 1); GridPane.setHgrow(slider, Priority.ALWAYS); } final Scene scene = new Scene(layout, 800, 700); stage.setScene(scene); stage.setTitle("Slider Demo"); stage.show(); markers.update(); }