本文整理汇总了Java中javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory方法的典型用法代码示例。如果您正苦于以下问题:Java SpinnerValueFactory.IntegerSpinnerValueFactory方法的具体用法?Java SpinnerValueFactory.IntegerSpinnerValueFactory怎么用?Java SpinnerValueFactory.IntegerSpinnerValueFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.SpinnerValueFactory
的用法示例。
在下文中一共展示了SpinnerValueFactory.IntegerSpinnerValueFactory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
@Override
public void init()
{
SpinnerValueFactory<Integer> spinnerYearValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 3000, currentDate.getYear());
spinnerYear.setValueFactory(spinnerYearValueFactory);
spinnerYear.setEditable(false);
spinnerYear.focusedProperty().addListener((observable, oldValue, newValue) -> {
if(!newValue)
{
spinnerYear.increment(0); // won't change value, but will commit editor
}
});
comboBoxMonth.getItems().addAll(Helpers.getMonthList());
comboBoxMonth.setValue(Helpers.getMonthList().get(currentDate.getMonthOfYear()-1));
applyStyle();
}
示例2: initializeSpinner
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
public static void initializeSpinner(final Spinner<Integer> spinner, final int minValue, final int maxValue, final int initialValue) {
spinner.getEditor().setOnKeyPressed(event -> {
switch (event.getCode()) {
case UP:
spinner.increment(1);
break;
case DOWN:
spinner.decrement(1);
break;
}
});
spinner.setOnScroll(e -> {
spinner.increment((int) (e.getDeltaY() / e.getMultiplierY()));
});
SpinnerValueFactory<Integer> factory = new SpinnerValueFactory.IntegerSpinnerValueFactory(minValue, maxValue, initialValue);
spinner.setValueFactory(factory);
spinner.setEditable(true);
TextFormatter<Integer> formatter = new TextFormatter<>(factory.getConverter(), factory.getValue());
spinner.getEditor().setTextFormatter(formatter);
factory.valueProperty().bindBidirectional(formatter.valueProperty());
}
示例3: initialize
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
@FXML
private void initialize() {
SpinnerValueFactory<Integer> attackValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
SpinnerValueFactory<Integer> strengthValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
SpinnerValueFactory<Integer> defenceValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
SpinnerValueFactory<Integer> hitpointsValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(9, Integer.MAX_VALUE);
SpinnerValueFactory<Integer> rangedValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
SpinnerValueFactory<Integer> magicValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
SpinnerValueFactory<Integer> prayerValueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, Integer.MAX_VALUE);
attackSpinner.setValueFactory(attackValueFactory);
strengthSpinner.setValueFactory(strengthValueFactory);
defenceSpinner.setValueFactory(defenceValueFactory);
rangedSpinner.setValueFactory(rangedValueFactory);
magicSpinner.setValueFactory(magicValueFactory);
hitpointsSpinner.setValueFactory(hitpointsValueFactory);
prayerSpinner.setValueFactory(prayerValueFactory);
attackSpinner.setEditable(true);
strengthSpinner.setEditable(true);
defenceSpinner.setEditable(true);
rangedSpinner.setEditable(true);
magicSpinner.setEditable(true);
prayerSpinner.setEditable(true);
hitpointsSpinner.setEditable(true);
}
示例4: initSpinnerRepeatingPeriod
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private void initSpinnerRepeatingPeriod()
{
SpinnerValueFactory<Integer> valueFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 1000, 0);
spinnerRepeatingPeriod.setValueFactory(valueFactory);
spinnerRepeatingPeriod.setEditable(false);
spinnerRepeatingPeriod.focusedProperty().addListener((observable, oldValue, newValue) -> {
if(!newValue)
{
spinnerRepeatingPeriod.increment(0); // won't change value, but will commit editor
}
});
}
示例5: setUpSpinnerInt
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private void setUpSpinnerInt(Spinner<Integer> spinner, int pos, int min, int max, int increment, int savedSet ){
IntegerSpinnerValueFactory oswFactory = new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max, savedSet, increment);
spinner.setValueFactory(oswFactory);
spinner.valueProperty().addListener((obs, oldValue, newValue) -> {
System.out.println("New value: "+newValue);
// hier könnte es rundungsfehler von double auf Number geben
setValueSettings(pos, newValue);
});
}
示例6: add
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
private Spinner<Integer> add(IntegerOption ro) {
Spinner<Integer> s = new Spinner<>(new SpinnerValueFactory.IntegerSpinnerValueFactory(ro.getMin(), ro.getMax(), ro.get()));
onSubmit.add(() -> ro.set(s.getValue()));
add(wrapWithText(s, ro.getDescribe()));
return s;
}
示例7: setSpinnerConfig
import javafx.scene.control.SpinnerValueFactory; //导入方法依赖的package包/类
/**
* setzt den spinner auf werte von 1 - 10
*/
private void setSpinnerConfig() {
SpinnerValueFactory svf = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 10);
bbyStepsMinute.setValueFactory(svf);
bbyStepsMinute.setOnMouseClicked(e -> getSpinnerValue());
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-immortalsgg,代码行数:9,代码来源:TDDTViewController.java