本文整理汇总了Java中javafx.scene.control.SpinnerValueFactory.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java SpinnerValueFactory.setValue方法的具体用法?Java SpinnerValueFactory.setValue怎么用?Java SpinnerValueFactory.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.SpinnerValueFactory
的用法示例。
在下文中一共展示了SpinnerValueFactory.setValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marathon_select
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的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;
}
示例2: commitEditorText
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的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;
}
}
示例3: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
double currentValue = 0;
double step = .1;
try {
if (logicalTimeFactory != null) {
switch (logicalTimeFactory.getName()) {
case "HLAfloat64Time":
currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
break;
case "HLAinteger64Time":
step = 1;
currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
break;
}
}
} catch (Exception ex) {
logger.log(Level.WARN, ex.getMessage(), ex);
}
SpinnerValueFactory sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
sVF.setValue(currentValue);
LogicalTimeSpin.setValueFactory(sVF);
logger.exit();
}
示例4: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logger.entry();
double currentValue = 0;
double step = .1;
try {
if (logicalTimeFactory != null) {
switch (logicalTimeFactory.getName()) {
case "HLAfloat64Time":
currentValue = ((HLAfloat64Time) currentLogicalTime).getValue();
break;
case "HLAinteger64Time":
step = 1;
currentValue = ((HLAinteger64Time) currentLogicalTime).getValue();
break;
}
}
} catch (Exception ex) {
logger.log(Level.WARN, ex.getMessage(), ex);
}
SpinnerValueFactory<Double> sVF = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, Double.MAX_VALUE, 0, step);
sVF.setValue(currentValue);
LogicalTimeSpin.setValueFactory(sVF);
logger.exit();
}
示例5: commitEditorText
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
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);
}
}
}
示例6: commitEditorText
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private <T> 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) {
T value = converter.fromString(text);
valueFactory.setValue(value);
}
}
}
示例7: createSVF
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private SpinnerValueFactory<String> createSVF()
{
SpinnerValueFactory<String> svf = new TextSpinnerValueFactory();
svf.setValue(value_text);
return svf;
}