Java Code Examples for javafx.scene.control.SpinnerValueFactory#IntegerSpinnerValueFactory
The following examples show how to use
javafx.scene.control.SpinnerValueFactory#IntegerSpinnerValueFactory .
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: GemsPanel_Controller.java From Path-of-Leveling with MIT License | 7 votes |
@Override public void initialize(URL url, ResourceBundle rb) { // TODO rootPane.setVisible(false); /* Initializes the controller class. */ /** * Initializes the controller class. */ SpinnerValueFactory<Integer> valueFactoryFrom = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 1); SpinnerValueFactory<Integer> valueFactoryUntil = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 1); fromLevel.setValueFactory(valueFactoryFrom); fromLevel.setStyle(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); untilLevel.setValueFactory(valueFactoryUntil); untilLevel.setStyle(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); fromLevel.setEditable(true); untilLevel.setEditable(true); Util.addIntegerLimiterToIntegerSpinner(fromLevel, valueFactoryFrom); Util.addIntegerLimiterToIntegerSpinner(untilLevel, valueFactoryUntil); valueFactoryFrom.valueProperty().addListener((arg0, arg1, arg2) -> groupSliderChange(fromLevel.getValue(),0)); valueFactoryUntil.valueProperty().addListener((arg0, arg1, arg2) -> groupSliderChange(untilLevel.getValue(),1)); }
Example 2
Source File: SimpleIntegerControl.java From PreferencesFX with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); getStyleClass().addAll("simple-integer-control"); final SpinnerValueFactory.IntegerSpinnerValueFactory factory = new SpinnerValueFactory.IntegerSpinnerValueFactory( Integer.MIN_VALUE, Integer.MAX_VALUE, field.getValue() ); // override old converter (IntegerStringConverter) because it throws // NumberFormatException if value can not be parsed to Integer factory.setConverter(new NoExceptionStringConverter()); editableSpinner.setValueFactory(factory); editableSpinner.focusedProperty().addListener((observable, wasFocused, isFocused) -> { if (wasFocused && !isFocused) { overrideNonIntegerSpinnerValues(); } }); editableSpinner.addEventHandler(KeyEvent.ANY, event -> { if (event.getCode() == KeyCode.ENTER) { overrideNonIntegerSpinnerValues(); } }); }
Example 3
Source File: TrendChartController.java From OEE-Designer with MIT License | 6 votes |
public void initialize(DesignerApplication app) throws Exception { setApp(app); // button images setButtonImages(); // set up resolver item display intializeItemTable(); // value and state charts initializeCharts(); // spinner value factory for update period SpinnerValueFactory<Integer> periodValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE, DEFAULT_UPDATE_SEC); spUpdatePeriod.setValueFactory(periodValueFactory); }
Example 4
Source File: EquipmentPreferencesPanelController.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@FXML void initialize() { var potionValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(model.getMaxPotionLevelBounds().min, model.getMaxWandLevelBounds().max, SettingsHandler.maxPotionSpellLevel().getValue(), 1 ); potionSpinner.setValueFactory(potionValueFactory); var wandValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(model.getMaxWandLevelBounds().min, model.getMaxWandLevelBounds().max, SettingsHandler.maxWandSpellLevel().getValue(), 1 ); wandSpinner.setValueFactory(wandValueFactory); // TODO: consider adding an apply button that sets values rather than using binding directly model.maxPotionLevelProperty().bind(potionSpinner.valueProperty()); model.maxWandLevelProperty().bind(wandSpinner.valueProperty()); }
Example 5
Source File: EquipmentPreferencesPanelController.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
@FXML void initialize() { var potionValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(model.getMaxPotionLevelBounds().min, model.getMaxWandLevelBounds().max, SettingsHandler.maxPotionSpellLevel().getValue(), 1 ); potionSpinner.setValueFactory(potionValueFactory); var wandValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(model.getMaxWandLevelBounds().min, model.getMaxWandLevelBounds().max, SettingsHandler.maxWandSpellLevel().getValue(), 1 ); wandSpinner.setValueFactory(wandValueFactory); // TODO: consider adding an apply button that sets values rather than using binding directly model.maxPotionLevelProperty().bind(potionSpinner.valueProperty()); model.maxWandLevelProperty().bind(wandSpinner.valueProperty()); }
Example 6
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 7
Source File: JFXSpinner.java From tuxguitar with GNU Lesser General Public License v2.1 | 5 votes |
public JFXSpinner(JFXContainer<? extends Region> parent) { super(new Spinner<Integer>(), parent); this.selectionListener = new JFXSelectionListenerChangeManager<Number>(this); this.valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 100, 0); this.getControl().setValueFactory(this.valueFactory); }
Example 8
Source File: DateTimeEditorFactory.java From constellation with Apache License 2.0 | 4 votes |
private HBox createTimeSpinners() { datePicker = new DatePicker(); datePicker.setConverter(new LocalDateStringConverter( TemporalFormatting.DATE_FORMATTER, TemporalFormatting.DATE_FORMATTER)); datePicker.getEditor().textProperty().addListener((v, o, n) -> { update(); updateTimeZoneList(); }); datePicker.setValue(LocalDate.now()); datePicker.valueProperty().addListener((v, o, n) -> { update(); updateTimeZoneList(); }); hourSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 23)); minSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 59)); secSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 59)); milliSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 999)); hourSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getHour()); minSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getMinute()); secSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getSecond()); milliSpinner.getValueFactory().setValue(0); final HBox timeSpinnerContainer = new HBox(CONTROLS_DEFAULT_VERTICAL_SPACING); final Label dateLabel = new Label("Date:"); dateLabel.setId(LABEL_ID); dateLabel.setLabelFor(datePicker); final Label hourSpinnerLabel = new Label("Hour:"); hourSpinnerLabel.setId(LABEL_ID); hourSpinnerLabel.setLabelFor(hourSpinner); final Label minSpinnerLabel = new Label("Minute:"); minSpinnerLabel.setId(LABEL_ID); minSpinnerLabel.setLabelFor(minSpinner); final Label secSpinnerLabel = new Label("Second:"); secSpinnerLabel.setId(LABEL_ID); secSpinnerLabel.setLabelFor(secSpinner); final Label milliSpinnerLabel = new Label("Millis:"); milliSpinnerLabel.setId(LABEL_ID); milliSpinnerLabel.setLabelFor(milliSpinner); hourSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); minSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); secSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); milliSpinner.setPrefWidth(MILLIS_SPINNER_WIDTH); hourSpinner.setEditable(true); minSpinner.setEditable(true); secSpinner.setEditable(true); milliSpinner.setEditable(true); hourSpinner.valueProperty().addListener((o, n, v) -> { update(); updateTimeZoneList(); }); minSpinner.valueProperty().addListener((o, n, v) -> { update(); updateTimeZoneList(); }); secSpinner.valueProperty().addListener((o, n, v) -> { update(); updateTimeZoneList(); }); milliSpinner.valueProperty().addListener((o, n, v) -> { update(); updateTimeZoneList(); }); final VBox dateLabelNode = new VBox(5); dateLabelNode.getChildren().addAll(dateLabel, datePicker); final VBox hourLabelNode = new VBox(5); hourLabelNode.getChildren().addAll(hourSpinnerLabel, hourSpinner); final VBox minLabelNode = new VBox(5); minLabelNode.getChildren().addAll(minSpinnerLabel, minSpinner); final VBox secLabelNode = new VBox(5); secLabelNode.getChildren().addAll(secSpinnerLabel, secSpinner); final VBox milliLabelNode = new VBox(5); milliLabelNode.getChildren().addAll(milliSpinnerLabel, milliSpinner); timeSpinnerContainer.getChildren().addAll(dateLabelNode, hourLabelNode, minLabelNode, secLabelNode, milliLabelNode); return timeSpinnerContainer; }
Example 9
Source File: LocalDateTimeEditorFactory.java From constellation with Apache License 2.0 | 4 votes |
private HBox createTimeSpinners() { datePicker = new DatePicker(); datePicker.setConverter(new LocalDateStringConverter( TemporalFormatting.DATE_FORMATTER, TemporalFormatting.DATE_FORMATTER)); datePicker.getEditor().textProperty().addListener((v, o, n) -> { update(); }); datePicker.setValue(LocalDate.now()); datePicker.valueProperty().addListener((v, o, n) -> { update(); }); hourSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 23)); minSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 59)); secSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 59)); milliSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 999)); hourSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getHour()); minSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getMinute()); secSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getSecond()); milliSpinner.getValueFactory().setValue(0); final HBox timeSpinnerContainer = new HBox(CONTROLS_DEFAULT_VERTICAL_SPACING); final Label dateLabel = new Label("Date:"); dateLabel.setId(LABEL_ID); dateLabel.setLabelFor(datePicker); final Label hourSpinnerLabel = new Label("Hour:"); hourSpinnerLabel.setId(LABEL_ID); hourSpinnerLabel.setLabelFor(hourSpinner); final Label minSpinnerLabel = new Label("Minute:"); minSpinnerLabel.setId(LABEL_ID); minSpinnerLabel.setLabelFor(minSpinner); final Label secSpinnerLabel = new Label("Second:"); secSpinnerLabel.setId(LABEL_ID); secSpinnerLabel.setLabelFor(secSpinner); final Label milliSpinnerLabel = new Label("Millis:"); milliSpinnerLabel.setId(LABEL_ID); milliSpinnerLabel.setLabelFor(milliSpinner); hourSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); minSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); secSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); milliSpinner.setPrefWidth(MILLIS_SPINNER_WIDTH); hourSpinner.setEditable(true); minSpinner.setEditable(true); secSpinner.setEditable(true); milliSpinner.setEditable(true); hourSpinner.valueProperty().addListener((o, n, v) -> { update(); }); minSpinner.valueProperty().addListener((o, n, v) -> { update(); }); secSpinner.valueProperty().addListener((o, n, v) -> { update(); }); milliSpinner.valueProperty().addListener((o, n, v) -> { update(); }); final VBox dateLabelNode = new VBox(5); dateLabelNode.getChildren().addAll(dateLabel, datePicker); final VBox hourLabelNode = new VBox(5); hourLabelNode.getChildren().addAll(hourSpinnerLabel, hourSpinner); final VBox minLabelNode = new VBox(5); minLabelNode.getChildren().addAll(minSpinnerLabel, minSpinner); final VBox secLabelNode = new VBox(5); secLabelNode.getChildren().addAll(secSpinnerLabel, secSpinner); final VBox milliLabelNode = new VBox(5); milliLabelNode.getChildren().addAll(milliSpinnerLabel, milliSpinner); timeSpinnerContainer.getChildren().addAll(dateLabelNode, hourLabelNode, minLabelNode, secLabelNode, milliLabelNode); return timeSpinnerContainer; }
Example 10
Source File: TimeEditorFactory.java From constellation with Apache License 2.0 | 4 votes |
private HBox createTimeSpinners() { hourSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 23)); minSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 59)); secSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 59)); milliSpinner = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 999)); hourSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getHour()); minSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getMinute()); secSpinner.getValueFactory().setValue(LocalTime.now(ZoneOffset.UTC).getSecond()); milliSpinner.getValueFactory().setValue(0); final HBox timeSpinnerContainer = new HBox(CONTROLS_DEFAULT_VERTICAL_SPACING); final Label hourSpinnerLabel = new Label("hr:"); hourSpinnerLabel.setId(LABEL); hourSpinnerLabel.setLabelFor(hourSpinner); final Label minSpinnerLabel = new Label("min:"); minSpinnerLabel.setId(LABEL); minSpinnerLabel.setLabelFor(minSpinner); final Label secSpinnerLabel = new Label("sec:"); secSpinnerLabel.setId(LABEL); secSpinnerLabel.setLabelFor(secSpinner); final Label milliSpinnerLabel = new Label("ms:"); milliSpinnerLabel.setId(LABEL); milliSpinnerLabel.setLabelFor(milliSpinner); hourSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); minSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); secSpinner.setPrefWidth(NUMBER_SPINNER_WIDTH); milliSpinner.setPrefWidth(MILLIS_SPINNER_WIDTH); hourSpinner.setEditable(true); minSpinner.setEditable(true); secSpinner.setEditable(true); milliSpinner.setEditable(true); hourSpinner.valueProperty().addListener((o, n, v) -> { update(); }); minSpinner.valueProperty().addListener((o, n, v) -> { update(); }); secSpinner.valueProperty().addListener((o, n, v) -> { update(); }); milliSpinner.valueProperty().addListener((o, n, v) -> { update(); }); final VBox hourLabelNode = new VBox(5); hourLabelNode.getChildren().addAll(hourSpinnerLabel, hourSpinner); final VBox minLabelNode = new VBox(5); minLabelNode.getChildren().addAll(minSpinnerLabel, minSpinner); final VBox secLabelNode = new VBox(5); secLabelNode.getChildren().addAll(secSpinnerLabel, secSpinner); final VBox milliLabelNode = new VBox(5); milliLabelNode.getChildren().addAll(milliSpinnerLabel, milliSpinner); timeSpinnerContainer.getChildren().addAll(hourLabelNode, minLabelNode, secLabelNode, milliLabelNode); return timeSpinnerContainer; }
Example 11
Source File: SpinnerCtrl.java From DashboardFx with GNU General Public License v3.0 | 4 votes |
@Override public void initialize(URL location, ResourceBundle resources) { SpinnerValueFactory valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 100); spinner.setValueFactory(valueFactory); }
Example 12
Source File: NumericSpinner.java From beatoraja with GNU General Public License v3.0 | 4 votes |
private void setValue(SpinnerValueFactory.IntegerSpinnerValueFactory valueFactory, Integer value) { valueFactory.setValue(Math.min(Math.max(value, valueFactory.getMin()), valueFactory.getMax())); }
Example 13
Source File: SpinnerPropertyEditor.java From FXDesktopSearch with Apache License 2.0 | 4 votes |
public SpinnerPropertyEditor(final PropertySheet.Item property) { super(property, new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 200))); }