当前位置: 首页>>代码示例>>Java>>正文


Java IntegerSpinnerValueFactory类代码示例

本文整理汇总了Java中javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory的典型用法代码示例。如果您正苦于以下问题:Java IntegerSpinnerValueFactory类的具体用法?Java IntegerSpinnerValueFactory怎么用?Java IntegerSpinnerValueFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntegerSpinnerValueFactory类属于javafx.scene.control.SpinnerValueFactory包,在下文中一共展示了IntegerSpinnerValueFactory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkEditorText

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
private void checkEditorText() {
    IntegerSpinnerValueFactory valueFactory = getVF();

    try {
        int value = Integer.parseInt(getEditor().getText());
        int min = valueFactory.getMin();
        int max = valueFactory.getMax();

        value = Math.min(Math.max(min, value), max);

        getEditor().setText(String.valueOf(value));
        valueFactory.setValue(value);

    } catch (NumberFormatException e) {
        getEditor().setText(String.valueOf(valueFactory.getValue()));
    }
}
 
开发者ID:yiding-he,项目名称:redisfx,代码行数:18,代码来源:IntegerSpinner.java

示例2: initFieldsAndValidation

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
private void initFieldsAndValidation(ResourceBundle bundle) {

        // Setup input for name.
        validationSupport.registerValidator(txtName, false,
                new TextValidator(bundle.getString("dialog_create_user_error_name_required"), 255, false));

        // Setup input for birthday.
        validationSupport.registerValidator(dateBirthday.getEditor(), false,
                new DateValidator(bundle.getString("dialog_create_user_error_birthday_invalid"), true));

        // Setup input for height.
        spnHeight.setValueFactory(new IntegerSpinnerValueFactory(0, 9999, 0));
        spnHeight.focusedProperty().addListener(new SpinnerFocusChangeListener<>(spnHeight));
        validationSupport.registerValidator(spnHeight.getEditor(), false,
                new IntegerValidator(bundle.getString("dialog_create_user_error_height_invalid"), 0, 9999, true));
        lblHeightUnit.setText(bundle.getString(heightUnitConverter.getUnit().getI18N()));

        // Register validation.
        validationSupport.invalidProperty().addListener((observable, oldValue, newValue) -> {
            getDialogPane().lookupButton(OK).setDisable(newValue);
        });
        validationSupport.redecorate();
    }
 
开发者ID:tbressler,项目名称:waterrower-workout,代码行数:24,代码来源:CreateUserDialog.java

示例3: initialize

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
public void initialize() {
    super.initialize();

    //////////////////////////////////////////////////////////////

    spnFromIndex.setValueFactory(new IntegerSpinnerValueFactory(0, Integer.MAX_VALUE, 0));
    spnToIndex.setValueFactory(new IntegerSpinnerValueFactory(Integer.MIN_VALUE, Integer.MAX_VALUE, 100));

    Fx.fixIntegerSpinners(spnFromIndex, spnToIndex);

    //////////////////////////////////////////////////////////////

    txtKey.setOnKeyPressed(event -> {
        if (event.getCode() == KeyCode.ENTER) {
            listValues();
        }
    });

    //////////////////////////////////////////////////////////////

    // List key events
    lstValues.setOnKeyPressed(event -> {
        if (event.getCode() == KeyCode.C && event.isControlDown()) {    // Ctrl+C
            listItemCopyClicked();
        } else if (event.getCode() == KeyCode.DELETE) {                 // Delete
            deleteItem();
        }
    });

    // List mouse events
    lstValues.setOnMouseClicked(event -> {
        String value = lstValues.getSelectionModel().getSelectedItem();
        if (event.getClickCount() == 2 && value != null) {
            editListItem();
        }
    });
}
 
开发者ID:yiding-he,项目名称:redisfx,代码行数:38,代码来源:ListTabController.java

示例4: initialize

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
/**
 * Called by JavaFX.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    int min = 0;
    int max = 100;
    int initialValue = 0;
    qtySpinner.setValueFactory(new IntegerSpinnerValueFactory(min, max, initialValue));
    qtySpinner.valueProperty().addListener(
        (obs, oldValue, newValue) -> {
            listController.updatePackageQty(this.packageData, newValue);
        }
    );
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:16,代码来源:PackageListItemController.java

示例5: initialize

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle rb) {
    minCount.setEditable(true);
    minCount.setValueFactory(new IntegerSpinnerValueFactory(min, max,min));
    minCount.valueProperty().addListener((observe, old, neo) -> update.run());
    maxCount.setEditable(true);
    maxCount.setValueFactory(new IntegerSpinnerValueFactory(min, max,max));
    maxCount.valueProperty().addListener((observe, old, neo) -> update.run());
}
 
开发者ID:NonlinearFruit,项目名称:Retrospector,代码行数:10,代码来源:FactoidChartPopupController.java

示例6: columnsSpinnerShouldBeBound

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
@Test public void columnsSpinnerShouldBeBound(){
   IntegerSpinnerValueFactory factory = ( IntegerSpinnerValueFactory )systemUnderTest.columnsSpinner().getValueFactory();
   Assert.assertEquals( 
            DimensionsPanel.MINIMUM_COLUMNS, 
            factory.getMin() 
   );
   Assert.assertEquals( 
            DimensionsPanel.MAXIMUM_COLUMNS, 
            factory.getMax() 
   );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:12,代码来源:DimensionsPanelTest.java

示例7: initialiseSystemUnderTest

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
@Before public void initialiseSystemUnderTest(){
   TestApplication.startPlatform();
   PlatformImpl.runAndWait( () -> {
      systemUnderTest = new IntegerPropertySpinner();
      systemUnderTest.setValueFactory( new IntegerSpinnerValueFactory( 0, 100 ) );
   } );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:8,代码来源:IntegerPropertySpinnerTest.java

示例8: setUpSpinnerInt

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的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);
	});
}
 
开发者ID:Raldir,项目名称:3DScanner.RaspberryPi,代码行数:10,代码来源:UIController.java

示例9: createYearSelector

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
/**
 * Creates the {@link ComboBox} used for selection a year.
 * 
 * @return the {@link ComboBox} for selecting a year.
 */
private Spinner<Integer> createYearSelector()
{
	Spinner<Integer> yearSpinner = new FXSpinnerRT40623<>(new IntegerSpinnerValueFactory(Integer.MIN_VALUE, Integer.MAX_VALUE));
	yearSpinner.getStyleClass().add("year-selector");
	yearSpinner.setEditable(true);
	yearSpinner.valueProperty().addListener(this::onSelectedYearChanged);
	
	return yearSpinner;
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:15,代码来源:FXDateTimePickerSkin.java

示例10: setSpinnerBehaviour

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
private static void setSpinnerBehaviour(
    final IntegerSpinnerValueFactory svf,
    final boolean useDefaultValue,
    final ObservableIntegerValue defaultValue,
    final ObjectProperty<Integer> customValue
) {
    if (useDefaultValue) {
        svf.valueProperty().unbindBidirectional(customValue);
        svf.setValue(defaultValue.get());
    } else {
        svf.setValue(customValue.getValue());
        svf.valueProperty().bindBidirectional(customValue);
    }
}
 
开发者ID:speedment,项目名称:speedment,代码行数:15,代码来源:DefaultSpinnerItem.java

示例11: TimeRangeFieldSkin

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
public TimeRangeFieldSkin(TimeRangeField control) {
    super(control);

    ComboBox<TimeRangeField.TimeRangeFieldValue> valuesComboBox = new ComboBox<>();
    valuesComboBox.setConverter(new TimeRangeFieldValueStringConverter());
    valuesComboBox.setItems(control.getValues());
    valuesComboBox.valueProperty().bindBidirectional(control.valueProperty());
    valuesComboBox.setVisibleRowCount(5);

    datePicker = new DatePicker();
    datePicker.getEditor().setPrefColumnCount(6);
    datePicker.valueProperty().bindBidirectional(control.onDateProperty());
    datePicker.managedProperty().bind(datePicker.visibleProperty());
    datePicker.setEditable(false);

    weekValueFactory = new IntegerSpinnerValueFactory(1, 52);
    weekValueFactory.valueProperty().addListener(obs -> control.setOnWeekNumber(weekValueFactory.getValue()));
    control.onWeekNumberProperty().addListener(obs -> {
        if (control.getOnWeekNumber() != null) {
            weekValueFactory.setValue(control.getOnWeekNumber());
        }
    });
    weekNumberSpinner = new Spinner<>();
    weekNumberSpinner.setValueFactory(weekValueFactory);
    weekNumberSpinner.managedProperty().bind(weekNumberSpinner.visibleProperty());
    weekNumberSpinner.setPrefWidth(70);

    monthYearValueFactory = new IntegerSpinnerValueFactory(1972, 3000);
    monthYearValueFactory.valueProperty().addListener(obs -> control.setMonthYear(monthYearValueFactory.getValue()));
    control.monthYearProperty().addListener(obs -> {
        if (control.getMonthYear() != null) {
            monthYearValueFactory.setValue(control.getMonthYear());
        }
    });

    monthYearSpinner = new Spinner<>();
    monthYearSpinner.getEditor().setPrefColumnCount(6);
    monthYearSpinner.setValueFactory(monthYearValueFactory);
    monthYearSpinner.managedProperty().bind(monthYearSpinner.visibleProperty());

    afterUnitsValueFactory = new IntegerSpinnerValueFactory(1, 500);
    afterUnitsValueFactory.valueProperty().addListener(obs -> control.setAfterUnits(afterUnitsValueFactory.getValue()));
    control.afterUnitsProperty().addListener(obs -> {
        if (control.getAfterUnits() != null) {
            afterUnitsValueFactory.setValue(control.getAfterUnits());
        }
    });
    afterUnitsSpinner = new Spinner<>();
    afterUnitsSpinner.getEditor().setPrefColumnCount(4);
    afterUnitsSpinner.setValueFactory(afterUnitsValueFactory);
    afterUnitsSpinner.managedProperty().bind(afterUnitsSpinner.visibleProperty());
    afterUnitsLabel = new Label();
    afterUnitsLabel.managedProperty().bind(afterUnitsLabel.visibleProperty());

    InvalidationListener listener = obs -> layout();
    control.viewTypeProperty().addListener(listener);
    control.valueProperty().addListener(listener);

    HBox container = new HBox(5, valuesComboBox, datePicker, weekNumberSpinner, monthYearSpinner, afterUnitsSpinner, afterUnitsLabel);
    container.setAlignment(Pos.CENTER_LEFT);
    HBox.setHgrow(valuesComboBox, Priority.ALWAYS);
    HBox.setHgrow(datePicker, Priority.SOMETIMES);

    getChildren().add(container);
    layout();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:67,代码来源:TimeRangeFieldSkin.java

示例12: getVF

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
private IntegerSpinnerValueFactory getVF() {
    return (IntegerSpinnerValueFactory) getValueFactory();
}
 
开发者ID:yiding-he,项目名称:redisfx,代码行数:4,代码来源:IntegerSpinner.java

示例13: configureIntegerSpinner

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
private void configureIntegerSpinner(Spinner<Integer> spinner, Property<Integer> prop, int min, int max) {
    IntegerSpinnerValueFactory factory = new IntegerSpinnerValueFactory(min, max);
    factory.valueProperty().bindBidirectional(prop);
    spinner.setValueFactory(factory);
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:6,代码来源:PreferencesController.java

示例14: IntegerControl

import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory; //导入依赖的package包/类
public IntegerControl(Options o, IntegerSetting setting) {
	setSpacing(3);
	
	// Option Name
	Label title = new Label(setting.getHumanName());
	title.getStyleClass().add("title");
	title.setFont(new Font(20));
	getChildren().add(title);

	// Option Desc
	if (!setting.getDescription().equals("")) {
		Label desc = new Label(setting.getDescription());
		desc.getStyleClass().add("description");
		desc.setFont(new Font(14));
		desc.setWrapText(true);
		getChildren().add(desc);
	}

	// Option Value
	Spinner<Integer> value = new Spinner<>();
	IntegerSpinnerValueFactory factory = new IntegerSpinnerValueFactory(0, 0);
	factory.setMax(setting.getHighBound());
	factory.setMin(setting.getLowBound());
	factory.setValue(setting.getValue());
	value.setValueFactory(factory);
	value.setEditable(true);
	value.getStyleClass().add("value");
	value.setPrefWidth(Double.MAX_VALUE);
	value.valueProperty().addListener(e -> {
		if (setting.isValid(value.getValue())) {
			o.madeChanges();
			setting.setValue(value.getValue());
		} else
			value.getValueFactory().setValue(setting.getValue());
	});
	getChildren().add(value);

	// Tooltip
	// Tooltip tooltip = new Tooltip(setting.getDescription());
	// Tooltip.install(title, tooltip);
	// Tooltip.install(value, tooltip);
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:43,代码来源:IntegerControl.java


注:本文中的javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。