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


Java SpinnerValueFactory类代码示例

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


SpinnerValueFactory类属于javafx.scene.control包,在下文中一共展示了SpinnerValueFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:JavaFXSpinnerElement.java

示例2: createListSpinner

import javafx.scene.control.SpinnerValueFactory; //导入依赖的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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:SpinnerSample.java

示例3: 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;
    }
}
 
开发者ID:tbressler,项目名称:waterrower-workout,代码行数:20,代码来源:SpinnerFocusChangeListener.java

示例4: 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();
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:19,代码来源:DatePickerController.java

示例5: revealParameters

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
private void revealParameters(Projection proj) {
	this.suppressListeners.set();
	final String[] paramNames = proj.getParameterNames();
	final double[][] paramValues = proj.getParameterValues();
	paramGrid.getChildren().clear();
	for (int i = 0; i < proj.getNumParameters(); i ++) {
		paramLabels[i].setText(paramNames[i]+":");
		paramSliders[i].setMin(paramValues[i][0]);
		paramSliders[i].setMax(paramValues[i][1]);
		paramSliders[i].setValue(paramValues[i][2]);
		final SpinnerValueFactory.DoubleSpinnerValueFactory paramSpinVF =
				(DoubleSpinnerValueFactory) paramSpinners[i].getValueFactory();
		paramSpinVF.setMin(paramValues[i][0]);
		paramSpinVF.setMax(paramValues[i][1]);
		paramSpinVF.setValue(paramValues[i][2]);
		final Tooltip tt = new Tooltip(
				"Change the "+paramNames[i]+" of the map (default is " + paramValues[i][2]+")");
		paramSliders[i].setTooltip(tt);
		paramSpinners[i].setTooltip(tt);
		paramGrid.addRow(i, paramLabels[i], paramSliders[i], paramSpinners[i]);
	}
	this.suppressListeners.clear();
}
 
开发者ID:jkunimune15,项目名称:Map-Projections,代码行数:24,代码来源:MapApplication.java

示例6: NumberSpinnerInputSocketController

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
/**
 * @param socket An <code>InputSocket</code> with a domain containing two <code>Number</code>s
 *               (the min and max slider values), or no domain at all.
 */
@Inject
NumberSpinnerInputSocketController(SocketHandleView.Factory socketHandleViewFactory,
                                   GripPlatform platform, @Assisted InputSocket<Number> socket) {
  super(socketHandleViewFactory, socket);
  this.platform = platform;

  final Number[] domain = socket.getSocketHint().getDomain().orElse(DEFAULT_DOMAIN);

  checkArgument(domain.length == 2, "Spinners must have a domain with two numbers (min and max)");

  final double min = domain[0].doubleValue();
  final double max = domain[1].doubleValue();
  final double initialValue = socket.getValue().get().doubleValue();
  this.valueFactory = new SpinnerValueFactory.DoubleSpinnerValueFactory(min, max, initialValue);
  this.updateSocketFromSpinner = o -> this.getSocket().setValue(this.valueFactory.getValue());
  this.valueFactory.valueProperty().addListener(this.updateSocketFromSpinner);
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:22,代码来源:NumberSpinnerInputSocketController.java

示例7: ListSpinnerInputSocketController

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
/**
 * @param socket an input socket where the domain contains all of the possible values to choose
 *               from.
 */
@Inject
ListSpinnerInputSocketController(EventBus eventBus, SocketHandleView.Factory
    socketHandleViewFactory, GripPlatform platform, @Assisted InputSocket<List> socket) {
  super(socketHandleViewFactory, socket);
  this.platform = platform;

  final Object[] domain = socket.getSocketHint().getDomain().get();

  @SuppressWarnings("unchecked")
  ObservableList<List> domainList = (ObservableList) FXCollections.observableList(
      Arrays.asList(domain));

  this.valueFactory = new SpinnerValueFactory.ListSpinnerValueFactory<>(domainList);
  this.updateSocketFromSpinner = o -> this.getSocket().setValue(this.valueFactory.getValue());
  this.valueFactory.setValue(socket.getValue().get());
  this.valueFactory.valueProperty().addListener(this.updateSocketFromSpinner);
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:22,代码来源:ListSpinnerInputSocketController.java

示例8: initialize

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
public void initialize() {
    solverTable.setItems(viewModel.solverTableItems());

    activeColumn.setCellValueFactory(new PropertyValueFactory<>("active"));
    activeColumn.setCellFactory(CheckBoxTableCell.forTableColumn(activeColumn));
    nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    averageColumn.setCellValueFactory(new PropertyValueFactory<>("average"));
    medianColumn.setCellValueFactory(new PropertyValueFactory<>("median"));
    maxColumn.setCellValueFactory(new PropertyValueFactory<>("max"));
    minColumn.setCellValueFactory(new PropertyValueFactory<>("min"));
    progressColumn.setCellValueFactory(new PropertyValueFactory<>("progress"));
    progressColumn.setCellFactory(ProgressBarTableCell.forTableColumn());

    sampleSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(viewModel.getMinSampleSize(), viewModel.getMaxSampleSize(), viewModel.getDefaultSampleSize(), viewModel.getStepSize()));
    viewModel.sampleSize().bind(sampleSpinner.valueProperty());
}
 
开发者ID:lestard,项目名称:ColorPuzzleFX,代码行数:17,代码来源:BenchmarkView.java

示例9: setupHandicapSpinner

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
private void setupHandicapSpinner() {
	ObservableList<Integer> handicaps = FXCollections.observableArrayList(new ArrayList<>());
	handicaps.add(0);
	for (int i = 2; i < 10; i++)
		handicaps.add(i);

	SpinnerValueFactory<Integer> handicapFactory = new ListSpinnerValueFactory<>(handicaps);
	handicapFactory.setWrapAround(true);
	handicapFactory.setConverter(new HandicapConverter());

	handicapSpinner.setValueFactory(handicapFactory);
	handicapSpinner.setEditable(true);
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:14,代码来源:NewLocalGameController.java

示例10: initialize

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
@Override
public void initialize(final URL location, final ResourceBundle resources) {
    base.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(0, Integer.MAX_VALUE));
    base.getValueFactory().setValue(1);
    // Commit changed values on manual edit of spinner
    base.focusedProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue) {
            base.increment(0); // won't change value, but will commit edited value
        }
    });

    genome.itemsProperty().bind(genomeNavigation.getGenomeNames());
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:14,代码来源:GenomeNavigateController.java

示例11: createDoubleSpinner

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
private Spinner<Double> createDoubleSpinner() {
    Spinner<Double> spinner = new Spinner<Double>();
    spinner.setId("double-spinner");
    spinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(25.50, 50.50));
    spinner.setEditable(true);
    return spinner;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:SpinnerSample.java

示例12: setTarget

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
public void setTarget(IntRange target, IntRange borders) {

        this.target = null;
        exactFrom.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(borders.getFrom(), borders.getTo(), target.getFrom()));
        exactTo.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(borders.getFrom(), borders.getTo(), target.getTo()));
        slider.minProperty().set(borders.getFrom());
        slider.maxProperty().set(borders.getTo());
        slider.lowValueProperty().setValue(target.getFrom());
        slider.highValueProperty().setValue(target.getTo());
        slider.lowValueProperty().setValue(target.getFrom());
        slider.highValueProperty().setValue(target.getTo());
        this.target = target;
    }
 
开发者ID:rumangerst,项目名称:CSLMusicModStationCreator,代码行数:14,代码来源:IntRangeEditor.java

示例13: 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());

}
 
开发者ID:gmuecke,项目名称:boutique-de-jus,代码行数:25,代码来源:SpinnerUtil.java

示例14: 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);

}
 
开发者ID:landonreams,项目名称:osrs-equipment-builder,代码行数:28,代码来源:PlayerEditDialogController.java

示例15: setSpinnerValueFactory

import javafx.scene.control.SpinnerValueFactory; //导入依赖的package包/类
public void setSpinnerValueFactory(final Spinner _spinner, final String _newValue) {
    ObservableList<String> items = FXCollections.observableArrayList("Jonathan", "Julia", "Henry");
    switch (_newValue) {
        case "Integer": {
            _spinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(5, 10));
            break;
        }

        case "List<String>": {
            _spinner.setValueFactory(new SpinnerValueFactory.ListSpinnerValueFactory<>(items));
            break;
        }
        /*    postponed.  see https://javafx-jira.kenai.com/browse/RT-37968
        case "Calendar": {
            _spinner.setValueFactory(new SpinnerValueFactory.LocalDateSpinnerValueFactory());
            break;
        }
        */
        case "Double": {
            _spinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(0.0, 1.0, 0.5, 0.05));
            break;
        }
        default: {
            _spinner.setValueFactory(null);
            break;
        }

    }

}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:31,代码来源:SpinnerApp.java


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