本文整理汇总了Java中javafx.scene.control.Spinner类的典型用法代码示例。如果您正苦于以下问题:Java Spinner类的具体用法?Java Spinner怎么用?Java Spinner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Spinner类属于javafx.scene.control包,在下文中一共展示了Spinner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFormConstraints
import javafx.scene.control.Spinner; //导入依赖的package包/类
private void setFormConstraints(Node field) {
if (field instanceof ISetConstraints) {
((ISetConstraints) field).setFormConstraints(this);
} else if (field instanceof Button) {
_setFormConstraints((Button) field);
} else if (field instanceof TextField) {
_setFormConstraints((TextField) field);
} else if (field instanceof TextArea) {
_setFormConstraints((TextArea) field);
} else if (field instanceof ComboBox<?>) {
_setFormConstraints((ComboBox<?>) field);
} else if (field instanceof ChoiceBox<?>) {
_setFormConstraints((ChoiceBox<?>) field);
} else if (field instanceof CheckBox) {
_setFormConstraints((CheckBox) field);
} else if (field instanceof Spinner<?>) {
_setFormConstraints((Spinner<?>) field);
} else if (field instanceof VBox) {
_setFormConstraints((VBox) field);
} else if (field instanceof Label) {
_setFormConstraints((Label) field);
} else {
LOGGER.info("FormPane.setFormConstraints(): unknown field type: " + field.getClass().getName());
}
}
示例2: marathon_select
import javafx.scene.control.Spinner; //导入依赖的package包/类
@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;
}
示例3: createListSpinner
import javafx.scene.control.Spinner; //导入依赖的package包/类
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;
}
示例4: getText
import javafx.scene.control.Spinner; //导入依赖的package包/类
@Test public void getText() {
Spinner<?> spinner = (Spinner<?>) getPrimaryStage().getScene().getRoot().lookup(".spinner");
LoggingRecorder lr = new LoggingRecorder();
List<String> text = new ArrayList<>();
Platform.runLater(() -> {
RFXSpinner rfxSpinner = new RFXSpinner(spinner, null, null, lr);
spinner.getEditor().setText("March");
rfxSpinner.focusLost(null);
text.add(rfxSpinner.getAttribute("text"));
});
new Wait("Waiting for spinner text.") {
@Override public boolean until() {
return text.size() > 0;
}
};
AssertJUnit.assertEquals("March", text.get(0));
}
示例5: commitEditorText
import javafx.scene.control.Spinner; //导入依赖的package包/类
private void commitEditorText(Spinner<T> spinner) {
if (!spinner.isEditable()) return;
try {
String text = spinner.getEditor().getText();
SpinnerValueFactory<T> valueFactory = spinner.getValueFactory();
if (valueFactory != null) {
StringConverter<T> converter = valueFactory.getConverter();
if (converter != null) {
T value = converter.fromString(text);
if (value == null)
return;
valueFactory.setValue(value);
}
}
} catch (NumberFormatException e) {
// Ignore text input.
return;
}
}
示例6: createZoomSpinner
import javafx.scene.control.Spinner; //导入依赖的package包/类
private Spinner<Integer> createZoomSpinner(ToggleButton btnZoom, String ip)
{
Spinner<Integer> spinnerZoom = new Spinner<>(googleMinZoomLevel, googleMaxZoomLevel, googleDefaultZoomLevel, googleZoomLevelStep);
spinnerZoom.setPrefWidth(55);
spinnerZoom.setPrefHeight(btnZoom.getHeight());
spinnerZoom.valueProperty().addListener((ChangeListener<Integer>) (observable, oldValue, newValue) ->
{
imgService.setCenterOnIP(ip, newValue);
labelUnderMap.setVisible(true);
generateAndShowImage();
});
Tooltip spinnerTooltip = new Tooltip("Set zoom level (1-20)");
ToolTipUtilities.setTooltipProperties(spinnerTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
spinnerZoom.setTooltip(spinnerTooltip);
spinnerZoom.getEditor().setTooltip(spinnerTooltip);
spinnerZoom.setEditable(false);
spinnerZoom.setDisable(true);
return spinnerZoom;
}
示例7: SpinnerTableCell
import javafx.scene.control.Spinner; //导入依赖的package包/类
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) {
spinner = new Spinner<>(min, max, 1);
spinner.editableProperty().bind(column.editableProperty());
spinner.disableProperty().bind(column.editableProperty().not());
tableRowProperty().addListener(e -> {
TableRow<?> row = getTableRow();
if (row == null)
return;
MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem();
if (dataSet == null)
return;
spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty());
disableProperty().bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED));
});
}
示例8: SpinnerTableCell
import javafx.scene.control.Spinner; //导入依赖的package包/类
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) {
spinner = new Spinner<>(min, max, 1);
spinner.editableProperty().bind(column.editableProperty());
spinner.disableProperty().bind(column.editableProperty().not());
tableRowProperty().addListener(e -> {
TableRow<?> row = getTableRow();
if (row == null)
return;
ChromatogramPlotDataSet dataSet = (ChromatogramPlotDataSet) row.getItem();
if (dataSet == null)
return;
spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty());
});
}
示例9: initialize
import javafx.scene.control.Spinner; //导入依赖的package包/类
@FXML
@Override
public void initialize() {
super.initialize();
final Spinner<List> spinner = new Spinner<>(this.valueFactory);
spinner.setEditable(true);
spinner.disableProperty().bind(this.getHandle().connectedProperty());
spinner.focusedProperty().addListener((s, ov, nv) -> {
// Code found at http://stackoverflow.com/questions/32340476/manually-typing-in-text-in-javafx-spinner-is-not-updating-the-value-unless-user
if (nv) {
return;
}
commitEditorText(spinner);
});
this.setContent(spinner);
}
示例10: reset
import javafx.scene.control.Spinner; //导入依赖的package包/类
public static void reset() {
add(Node.class, JavaFXElement.class);
add(TextInputControl.class, JavaFXTextInputControlElement.class);
add(HTMLEditor.class, JavaFXHTMLEditor.class);
add(CheckBox.class, JavaFXCheckBoxElement.class);
add(ToggleButton.class, JavaFXToggleButtonElement.class);
add(Slider.class, JavaFXSliderElement.class);
add(Spinner.class, JavaFXSpinnerElement.class);
add(SplitPane.class, JavaFXSplitPaneElement.class);
add(ProgressBar.class, JavaFXProgressBarElement.class);
add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
add(ColorPicker.class, JavaFXColorPickerElement.class);
add(ComboBox.class, JavaFXComboBoxElement.class);
add(DatePicker.class, JavaFXDatePickerElement.class);
add(TabPane.class, JavaFXTabPaneElement.class);
add(ListView.class, JavaFXListViewElement.class);
add(TreeView.class, JavaFXTreeViewElement.class);
add(TableView.class, JavaFXTableViewElement.class);
add(TreeTableView.class, JavaFXTreeTableViewElement.class);
add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
add(TableCell.class, JavaFXTableViewCellElement.class);
add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
示例11: selectListSpinner
import javafx.scene.control.Spinner; //导入依赖的package包/类
@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");
}
};
}
示例12: selectEditableListSpinner
import javafx.scene.control.Spinner; //导入依赖的package包/类
@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");
}
};
}
示例13: listSpinnerWithInvalidValue
import javafx.scene.control.Spinner; //导入依赖的package包/类
@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");
}
};
}
示例14: selectIntegerSpinner
import javafx.scene.control.Spinner; //导入依赖的package包/类
@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;
}
};
}
示例15: selectEditableIntegerSpinner
import javafx.scene.control.Spinner; //导入依赖的package包/类
@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;
}
};
}