javafx.scene.control.SpinnerValueFactory Java Examples
The following examples show how to use
javafx.scene.control.SpinnerValueFactory.
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: 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 #3
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 #4
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 #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: JavaFXSpinnerElement.java From marathonv5 with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public boolean marathon_select(String value) { Spinner<?> spinner = (Spinner<?>) getComponent(); if (!spinner.isEditable()) { @SuppressWarnings("rawtypes") SpinnerValueFactory factory = ((Spinner<?>) getComponent()).getValueFactory(); Object convertedValue = factory.getConverter().fromString(value); factory.setValue(convertedValue); return true; } TextField spinnerEditor = spinner.getEditor(); if (spinnerEditor == null) { throw new JavaAgentException("Null value returned by getEditor() on spinner", null); } IJavaFXElement ele = JavaFXElementFactory.createElement(spinnerEditor, driver, window); spinnerEditor.getProperties().put("marathon.celleditor", true); ele.marathon_select(value); return true; }
Example #7
Source File: SpinnerSample.java From marathonv5 with Apache License 2.0 | 6 votes |
private Spinner<Object> createListSpinner() { Spinner<Object> spinner = new Spinner<>(); spinner.setId("list-spinner"); List<Object> names = new ArrayList<Object>(); names.add("January"); names.add("February"); names.add("March"); names.add("April"); names.add("May"); names.add("June"); names.add("July"); names.add("August"); names.add("September"); names.add("October"); names.add("November"); names.add("December"); spinner.setValueFactory(new SpinnerValueFactory.ListSpinnerValueFactory<Object>(FXCollections.observableArrayList(names))); return spinner; }
Example #8
Source File: NumericSpinner.java From beatoraja with GNU General Public License v3.0 | 6 votes |
private void commitEditorText(Spinner<T> spinner) { if (!spinner.isEditable()) { return; } String text = spinner.getEditor().getText(); SpinnerValueFactory<T> valueFactory = spinner.getValueFactory(); if (valueFactory != null) { StringConverter<T> converter = valueFactory.getConverter(); if (converter != null) { try { T value = converter.fromString(text); setValue(valueFactory, value); } catch (Exception e) { spinner.getEditor().setText(valueFactory.getValue().toString()); } } } }
Example #9
Source File: ItemAirBaseController.java From logbook-kai with MIT License | 5 votes |
/** * Spinnerの変更を即座に反映する * * @param spinner Spinner */ private <T> void spinnerHandller(Spinner<T> spinner) { spinner.getEditor().textProperty().addListener((ob, o, n) -> { SpinnerValueFactory<T> f = spinner.getValueFactory(); T value = f.getConverter().fromString("".equals(n) ? "0" : n); if (!value.equals(f.getValue())) { f.setValue(value); } }); }
Example #10
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 #11
Source File: SpinnerAutoCommit.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
private void commitEditorText() { if (!isEditable()) return; String text = getEditor().getText(); SpinnerValueFactory<T> valueFactory = getValueFactory(); if (valueFactory != null) { StringConverter<T> converter = valueFactory.getConverter(); if (converter != null) { T value = converter.fromString(text); valueFactory.setValue(value); } } }
Example #12
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 #13
Source File: GeneralOptionsPane.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 5 votes |
@SuppressWarnings("unchecked") GeneralOptionsPane() { initComponents(); Font titleFont = Font.font(16); editorSettingsLabel.setFont(titleFont); fileSettingsLabel.setFont(titleFont); // font family fontFamilyField.getItems().addAll(getMonospacedFonts()); fontFamilyField.getSelectionModel().select(0); fontFamilyField.setButtonCell(new FontListCell()); fontFamilyField.setCellFactory(p -> new FontListCell()); // font size fontSizeField.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(Options.MIN_FONT_SIZE, Options.MAX_FONT_SIZE)); // line separator String defaultLineSeparator = System.getProperty( "line.separator", "\n" ); String defaultLineSeparatorStr = defaultLineSeparator.replace("\r", "CR").replace("\n", "LF"); lineSeparatorField.getItems().addAll( new Item<>(Messages.get("GeneralOptionsPane.platformDefault", defaultLineSeparatorStr), null), new Item<>(Messages.get("GeneralOptionsPane.sepWindows"), "\r\n"), new Item<>(Messages.get("GeneralOptionsPane.sepUnix"), "\n")); // encoding encodingField.getItems().addAll(getAvailableEncodings()); // file extensions markdownFileExtensionsField.setPromptText(Options.DEF_MARKDOWN_FILE_EXTENSIONS); }
Example #14
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 #15
Source File: EditorOptionsPane.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 5 votes |
EditorOptionsPane() { initComponents(); Font titleFont = Font.font(16); markersTitle.setFont(titleFont); formatTitle.setFont(titleFont); strongEmphasisMarkerField.getItems().addAll("**", "__"); emphasisMarkerField.getItems().addAll("*", "_"); bulletListMarkerField.getItems().addAll("-", "+", "*"); wrapLineLengthField.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(Options.MIN_WRAP_LINE_LENGTH, Integer.MAX_VALUE)); formatOnlyModifiedParagraphsCheckBox.disableProperty().bind(formatOnSaveCheckBox.selectedProperty().not()); }
Example #16
Source File: SpinnerSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private Spinner<Double> createDoubleSpinner() { Spinner<Double> spinner = new Spinner<Double>(); spinner.setId("double-spinner"); spinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(25.50, 50.50)); spinner.setEditable(true); return spinner; }
Example #17
Source File: ValidatorUtils.java From kafka-message-tool with MIT License | 5 votes |
public static void configureSpinner(Spinner<Integer> spinner, IntegerProperty referenceProperty, int minValue, int maxValue) { spinner.setEditable(true); spinner.setTooltip(TooltipCreator.createFrom("Max value: " + maxValue)); spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(minValue, Integer.MAX_VALUE, referenceProperty.get())); GuiUtils.configureTextFieldToAcceptOnlyValidData(spinner.getEditor(), stringConsumer(referenceProperty), validationFunc(maxValue)); configureTextFieldToAcceptOnlyDecimalValues(spinner.getEditor()); }
Example #18
Source File: SimpleDoubleControl.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void initializeParts() { super.initializeParts(); getStyleClass().add("simple-double-control"); editableSpinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory( -Double.MAX_VALUE, Double.MAX_VALUE, field.getValue() )); }
Example #19
Source File: WraparoundValueFactory.java From phoebus with Eclipse Public License 1.0 | 4 votes |
public WraparoundValueFactory(final int min, final int max, final SpinnerValueFactory<Integer> next) { this.min = min; this.max = max; this.next = next; }
Example #20
Source File: CalcExpController.java From logbook-kai with MIT License | 4 votes |
@FXML void initialize() { // SplitPaneの分割サイズ Timeline x = new Timeline(); x.getKeyFrames().add(new KeyFrame(Duration.millis(1), (e) -> { Tools.Conrtols.setSplitWidth(this.splitPane, this.getClass() + "#" + "splitPane"); })); x.play(); // Spinnerに最小値最大値現在値を設定 this.nowLv.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, ExpTable.maxLv(), 1, 1)); this.goalLv.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, ExpTable.maxLv(), 1, 1)); // コンボボックス this.shipList.setItems(this.ships); this.shipList(); // 海域 this.seaAreaList(); // 評価 this.rank.setItems(FXCollections.observableArrayList(Rank.values())); this.rank.getSelectionModel().select(AppConfig.get().getResultRank()); // カラムとオブジェクトのバインド this.id.setCellValueFactory(new PropertyValueFactory<>("id")); this.ship.setCellValueFactory(new PropertyValueFactory<>("ship")); this.ship.setCellFactory(p -> new ShipImageTableCell()); this.lv.setCellValueFactory(new PropertyValueFactory<>("lv")); this.afterLv.setCellValueFactory(new PropertyValueFactory<>("afterLv")); // 改装レベル不足の艦娘 this.shortageShip.setItems(this.item); this.shortageShip(); // イベントリスナー this.shipList.getSelectionModel() .selectedItemProperty() .addListener((ChangeListener<ShipWrapper>) this::changeShip); this.nowLv.getValueFactory() .valueProperty() .addListener((ChangeListener<Integer>) this::changeNowLv); this.goalLv.getValueFactory() .valueProperty() .addListener((ChangeListener<Integer>) this::changeGoalLv); this.sea.getSelectionModel() .selectedItemProperty() .addListener((ChangeListener<AppSeaAreaExp>) (ov, o, n) -> this.changeSeaArea()); this.rank.getSelectionModel() .selectedItemProperty() .addListener((ChangeListener<Rank>) (ov, o, n) -> this.update()); this.shortageShip.getSelectionModel() .selectedItemProperty() .addListener((ChangeListener<ShortageShipItem>) this::changeShip); // 旗艦ID Integer flagShipId = DeckPortCollection.get() .getDeckPortMap() .get(1) .getShip() .get(0); // 旗艦 ShipWrapper flagShip = this.ships.stream() .filter(w -> w.getShip().getId().equals(flagShipId)) .findAny() .get(); // 発火させるためにここでselect this.sea.getSelectionModel().select(AppConfig.get().getSeaAreaIndex()); this.shipList.getSelectionModel().select(flagShip); }
Example #21
Source File: SpinnerAutoCommit.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
public SpinnerAutoCommit(SpinnerValueFactory<T> valueFactory) { super(valueFactory); addListenerKeyChange(); }
Example #22
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))); }
Example #23
Source File: SpinnerCell.java From beatoraja with GNU General Public License v3.0 | 4 votes |
SpinnerCell(int min, int max, int initial, int step) { spinner = new NumericSpinner<>(); spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max, initial, step)); setEditable(true); }
Example #24
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())); }
Example #25
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 #26
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 #27
Source File: SpinnerRepresentation.java From phoebus with Eclipse Public License 1.0 | 4 votes |
private SpinnerValueFactory<String> createSVF() { SpinnerValueFactory<String> svf = new TextSpinnerValueFactory(); svf.setValue(value_text); return svf; }
Example #28
Source File: SpinnerSample.java From marathonv5 with Apache License 2.0 | 4 votes |
private Spinner<Integer> createIntegerSpinner() { Spinner<Integer> spinner = new Spinner<>(); spinner.setId("integer-spinner"); spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, 50)); return spinner; }
Example #29
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 #30
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; }