Java Code Examples for javafx.scene.control.SpinnerValueFactory#setValue()

The following examples show how to use javafx.scene.control.SpinnerValueFactory#setValue() . 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: JavaFXSpinnerElement.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@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 2
Source File: NumericSpinner.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
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: SpinnerAutoCommit.java    From old-mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
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 4
Source File: SpinnerRepresentation.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
private SpinnerValueFactory<String> createSVF()
{
    SpinnerValueFactory<String> svf = new TextSpinnerValueFactory();
    svf.setValue(value_text);
    return svf;
}