Java Code Examples for javafx.scene.control.SpinnerValueFactory#DoubleSpinnerValueFactory
The following examples show how to use
javafx.scene.control.SpinnerValueFactory#DoubleSpinnerValueFactory .
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: SpinnerDemo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void start(final Stage stage) { final Label label = new Label("Demo:"); SpinnerValueFactory<Double> svf = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, 1000); Spinner<Double> spinner = new Spinner<>(); spinner.setValueFactory(svf); spinner.editorProperty().getValue().setStyle("-fx-text-fill:" + "black"); spinner.editorProperty().getValue().setBackground( new Background(new BackgroundFill(Color.AZURE, CornerRadii.EMPTY, Insets.EMPTY))); //spinner.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL); //int x = spinner.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL); //if (x > 0) spinner.getStyleClass().remove(x); spinner.setEditable(true); spinner.setPrefWidth(80); spinner.valueProperty().addListener((prop, old, value) -> { System.out.println("Value: " + value); }); final HBox root = new HBox(label, spinner); final Scene scene = new Scene(root, 800, 700); stage.setScene(scene); stage.setTitle("Spinner Demo"); stage.show(); }
Example 2
Source File: NumericSpinner.java From beatoraja with GNU General Public License v3.0 | 5 votes |
private void setValue(SpinnerValueFactory<T> valueFactory, T value) { if (valueFactory instanceof SpinnerValueFactory.IntegerSpinnerValueFactory) { setValue((SpinnerValueFactory.IntegerSpinnerValueFactory) valueFactory, (Integer) value); } else if (valueFactory instanceof SpinnerValueFactory.DoubleSpinnerValueFactory) { setValue((SpinnerValueFactory.DoubleSpinnerValueFactory) valueFactory, (Double) value); } valueFactory.setValue(value); }
Example 3
Source File: NumericSpinner.java From beatoraja with GNU General Public License v3.0 | 4 votes |
private void setValue(SpinnerValueFactory.DoubleSpinnerValueFactory valueFactory, Double value) { valueFactory.setValue(Math.min(Math.max(value, valueFactory.getMin()), valueFactory.getMax())); }