Java Code Examples for javafx.scene.control.Spinner#getValue()
The following examples show how to use
javafx.scene.control.Spinner#getValue() .
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: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 7 votes |
@Test public void selectEditableListSpinner() { IJavaFXElement spinner = driver.findElementByName("list-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner"); Platform.runLater(() -> { spinnerNode.setEditable(true); spinner.marathon_select("December"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Object value = spinnerNode.getValue(); return value.toString().equals("December"); } }; }
Example 2
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void listSpinnerWithInvalidValue() { IJavaFXElement spinner = driver.findElementByName("list-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner"); Platform.runLater(() -> { spinnerNode.setEditable(true); spinner.marathon_select("Decem"); }); new Wait("Spinner was not reset.") { @Override public boolean until() { Object value = spinnerNode.getValue(); return value.toString().equals("January"); } }; }
Example 3
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void selectDoubleSpinner() { IJavaFXElement spinner = driver.findElementByName("double-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#double-spinner"); Platform.runLater(() -> { spinnerNode.setEditable(false); spinner.marathon_select("38.9"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Double value = (Double) spinnerNode.getValue(); return value == 38.9; } }; }
Example 4
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectListSpinner() { IJavaFXElement spinner = driver.findElementByName("list-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#list-spinner"); Platform.runLater(() -> { spinner.marathon_select("June"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Object value = spinnerNode.getValue(); return value.toString().equals("June"); } }; }
Example 5
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectIntegerSpinner() { IJavaFXElement spinner = driver.findElementByName("integer-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#integer-spinner"); Platform.runLater(() -> { spinner.marathon_select("35"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Integer value = (Integer) spinnerNode.getValue(); return value == 35; } }; }
Example 6
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectEditableIntegerSpinner() { IJavaFXElement spinner = driver.findElementByName("integer-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#integer-spinner"); Platform.runLater(() -> { spinner.marathon_select("45"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Integer value = (Integer) spinnerNode.getValue(); return value == 45; } }; }
Example 7
Source File: JavaFXSpinnerElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@Test public void selectEditableDoubleSpinner() { IJavaFXElement spinner = driver.findElementByName("double-spinner"); Spinner<?> spinnerNode = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup("#double-spinner"); Platform.runLater(() -> { spinner.marathon_select("49.0"); }); new Wait("Waiting for spinner to set value") { @Override public boolean until() { Double value = (Double) spinnerNode.getValue(); return value == 49.0; } }; }
Example 8
Source File: FxRobotSpinner.java From latexdraw with GNU General Public License v3.0 | 5 votes |
default <T extends Number> void doTestSpinner(final CmdVoid cmdsConfig, final Spinner<T> spinner, final CmdVoid cmdSpinner, final List<Supplier<T>> oracles) { cmdsConfig.execute(); final T val = spinner.getValue(); cmdSpinner.execute(); HelperTest.waitForTimeoutTransitions(); oracles.forEach(oracle -> assertEquals(spinner.getValue().doubleValue(), oracle.get().doubleValue(), 0.0001)); assertNotEquals(val.doubleValue(), spinner.getValue().doubleValue(), 0.0001); }
Example 9
Source File: PikaRFIDDirectReader.java From pikatimer with GNU General Public License v3.0 | 4 votes |
private void setClockDialog(){ Integer localTZ = TimeZone.getDefault().getOffset(System.currentTimeMillis())/3600000; Integer ultraTZ = Integer.parseInt(ultraSettings.get("23")); // open a dialog box Dialog<Boolean> dialog = new Dialog(); dialog.setTitle("Set Ultra Clock"); dialog.setHeaderText("Set the clock for " + ultraIP); ButtonType setButtonType = new ButtonType("Set", ButtonBar.ButtonData.OK_DONE); dialog.getDialogPane().getButtonTypes().addAll(setButtonType, ButtonType.CANCEL); VBox clockVBox = new VBox(); clockVBox.setStyle("-fx-font-size: 16px;"); CheckBox useComputer = new CheckBox("Sync with the local computer"); VBox manualVBox = new VBox(); manualVBox.setSpacing(5.0); manualVBox.disableProperty().bind(useComputer.selectedProperty()); HBox dateHBox = new HBox(); dateHBox.setSpacing(5.0); Label dateLabel = new Label("Date:"); dateLabel.setMinWidth(40); DatePicker ultraDate = new DatePicker(); dateHBox.getChildren().addAll(dateLabel,ultraDate); HBox timeHBox = new HBox(); timeHBox.setSpacing(5.0); Label timeLabel = new Label("Time:"); timeLabel.setMinWidth(40); TextField ultraTime = new TextField(); timeHBox.getChildren().addAll(timeLabel,ultraTime); HBox tzHBox = new HBox(); tzHBox.setSpacing(5.0); Label tzLabel = new Label("TimeZone:"); tzLabel.setMinWidth(40); Spinner<Integer> tzSpinner = new Spinner<>(-23, 23, localTZ); tzHBox.getChildren().addAll(tzLabel,tzSpinner); manualVBox.getChildren().addAll(dateHBox,timeHBox,tzHBox); CheckBox autoGPS = new CheckBox("Use GPS to auto-set the clock"); autoGPS.setSelected(true); clockVBox.getChildren().addAll(useComputer,manualVBox,autoGPS); dialog.getDialogPane().setContent(clockVBox); BooleanProperty timeOK = new SimpleBooleanProperty(false); ultraTime.textProperty().addListener((observable, oldValue, newValue) -> { timeOK.setValue(false); if (DurationParser.parsable(newValue)) timeOK.setValue(Boolean.TRUE); if ( newValue.isEmpty() || newValue.matches("^[0-9]*(:?([0-5]?([0-9]?(:([0-5]?([0-9]?)?)?)?)?)?)?") ){ System.out.println("Possiblely good start Time (newValue: " + newValue + ")"); } else { Platform.runLater(() -> { int c = ultraTime.getCaretPosition(); if (oldValue.length() > newValue.length()) c++; else c--; ultraTime.setText(oldValue); ultraTime.positionCaret(c); }); System.out.println("Bad clock time (newValue: " + newValue + ")"); } }); ultraDate.setValue(LocalDate.now()); ultraTime.setText(LocalTime.ofSecondOfDay(LocalTime.now().toSecondOfDay()).toString()); Node createButton = dialog.getDialogPane().lookupButton(setButtonType); createButton.disableProperty().bind(timeOK.not()); dialog.setResultConverter(dialogButton -> { if (dialogButton == setButtonType) { return Boolean.TRUE; } return null; }); Optional<Boolean> result = dialog.showAndWait(); if (result.isPresent()) { if (useComputer.selectedProperty().get()) { System.out.println("Timezone check: Local :" + localTZ + " ultra: " + ultraTZ); if (localTZ.equals(ultraTZ)) setClock(LocalDateTime.now(),null,autoGPS.selectedProperty().get()); else setClock(LocalDateTime.now(),localTZ,autoGPS.selectedProperty().get()); } else { LocalTime time = LocalTime.MIDNIGHT.plusSeconds(DurationParser.parse(ultraTime.getText()).getSeconds()); Integer newTZ = tzSpinner.getValue(); if (newTZ.equals(ultraTZ)) setClock(LocalDateTime.of(ultraDate.getValue(), time),null,autoGPS.selectedProperty().get()); else { setClock(LocalDateTime.of(ultraDate.getValue(), time),newTZ,autoGPS.selectedProperty().get()); } } } }