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


Java NumberStringConverter类代码示例

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


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

示例1: createMarginFields

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
private void createMarginFields() {
    NumericTextField topField = new NumericTextField();
    NumericTextField rightField = new NumericTextField();
    NumericTextField bottomField = new NumericTextField();
    NumericTextField leftField = new NumericTextField();

    StringConverter<Number> converter = new NumberStringConverter();

    leftField.textProperty().bindBidirectional(getSkinnable().leftMarginProperty(), converter);
    rightField.textProperty().bindBidirectional(getSkinnable().rightMarginProperty(), converter);
    topField.textProperty().bindBidirectional(getSkinnable().topMarginProperty(), converter);
    bottomField.textProperty().bindBidirectional(getSkinnable().bottomMarginProperty(), converter);

    marginsGridPane = new GridPane();
    marginsGridPane.getStyleClass().add("custom-fields");
    marginsGridPane.add(new Label(Messages.getString("MarginSelector.TOP")), 0, 0);
    marginsGridPane.add(topField, 1, 0);
    marginsGridPane.add(new Label(Messages.getString("MarginSelector.RIGHT")), 2, 0);
    marginsGridPane.add(rightField, 3, 0);
    marginsGridPane.add(new Label(Messages.getString("MarginSelector.BOTTOM")), 0, 1);
    marginsGridPane.add(bottomField, 1, 1);
    marginsGridPane.add(new Label(Messages.getString("MarginSelector.LEFT")), 2, 1);
    marginsGridPane.add(leftField, 3, 1);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:25,代码来源:PaperViewSkin.java

示例2: changed

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public void changed(GroupEntity previousSelected, GroupEntity currentSelected) {
	if (previousSelected != null) {
		xPosField.textProperty().unbindBidirectional(previousSelected.getRect().xProperty());
		yPosField.textProperty().unbindBidirectional(previousSelected.getRect().yProperty());
		heightField.textProperty().unbindBidirectional(previousSelected.getRect().heightProperty());
		widthField.textProperty().unbindBidirectional(previousSelected.getRect().widthProperty());
		rotateField.textProperty().unbindBidirectional(previousSelected.rotateProperty());
	}

	if (currentSelected != null) {
		xPosField.textProperty().bindBidirectional(currentSelected.getRect().xProperty(),
				new NumberStringConverter());
		yPosField.textProperty().bindBidirectional(currentSelected.getRect().yProperty(),
				new NumberStringConverter());
		heightField.textProperty().bindBidirectional(currentSelected.getRect().heightProperty(),
				new NumberStringConverter());
		widthField.textProperty().bindBidirectional(currentSelected.getRect().widthProperty(),
				new NumberStringConverter());
		rotateField.textProperty().bindBidirectional(currentSelected.rotateProperty(), new NumberStringConverter());
	}
}
 
开发者ID:pror21,项目名称:JFloor,代码行数:22,代码来源:FXMLMainController.java

示例3: initialize

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
@FXML
private void initialize(){
	circleButton.selectedProperty().bindBidirectional(presenter.getShapeProperty().getToggle(Shape.CIRCLE));
	squareButton.selectedProperty().bindBidirectional(presenter.getShapeProperty().getToggle(Shape.SQUARE));
	diamondButton.selectedProperty().bindBidirectional(presenter.getShapeProperty().getToggle(Shape.DIAMOND));
	
	airbrushButton.selectedProperty().bindBidirectional(presenter.getModeProperty().getToggle(Mode.AIRBRUSH));
	roughButton.selectedProperty().bindBidirectional(presenter.getModeProperty().getToggle(Mode.ROUGH));
	noiseButton.selectedProperty().bindBidirectional(presenter.getModeProperty().getToggle(Mode.NOISE));
	
	sizeSlider.setMax(PencilConfiguratorPresenter.MAX_SIZE);
	sizeSlider.valueProperty().bindBidirectional(presenter.getSizeProperty());
	sizeField.textProperty().bindBidirectional(presenter.getSizeProperty(), new NumberStringConverter());
	
	strengthSlider.valueProperty().bindBidirectional(presenter.getStrengthProperty());
	strengthField.textProperty().bindBidirectional(presenter.getStrengthProperty(), new NumberStringConverter());
}
 
开发者ID:meltzow,项目名称:supernovae,代码行数:18,代码来源:PencilConfigurator.java

示例4: init

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
@PostConstruct
public void init() {
	
	// Since this is a special page, we only allow to go back from here. 
	this.backButton.setVisible(false);
	this.nextButton.setVisible(false);
	this.finishButton.setText("Back");
	
	// Bind to datamodel
	mapDBAptamerPoolBloomFilterCapacityTextField.textProperty().bindBidirectional(getDataModel().getMapDBAptamerPoolBloomFilterCapacity(), new NumberStringConverter());
	mapDBAptamerPoolBloomFilterCollisionProbabilityTextField.textProperty().bindBidirectional(getDataModel().getMapDBAptamerPoolBloomFilterCollisionProbability(), new NumberStringConverter());
	mapDBAptamerPoolMaxTreeMapCapacityTextField.textProperty().bindBidirectional(getDataModel().getMapDBAptamerPoolMaxTreeMapCapacity(), new NumberStringConverter());
	mapDBSelectionCycleBloomFilterCollisionProbabilityTextField.textProperty().bindBidirectional(getDataModel().getMapDBSelectionCycleBloomFilterCollisionProbability(), new NumberStringConverter());
	performanceMaxNumberOfCoresSpinner.getValueFactory().valueProperty().bindBidirectional(getDataModel().getPerformanceMaxNumberOfCores());

}
 
开发者ID:drivenbyentropy,项目名称:aptasuite,代码行数:17,代码来源:WizardAdvancedOptionsController.java

示例5: initialize

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
@Override
public void initialize(final URL location, final ResourceBundle resources) {
    nodeId.setTextFormatter(new TextFormatter<>(new NumberStringConverter()));
    radius.setTextFormatter(new TextFormatter<>(new NumberStringConverter()));

    currentNodeId.textProperty().bind(graphDimensionsCalculator.getCenterNodeIdProperty().asString());
    currentRadius.textProperty().bind(graphDimensionsCalculator.getRadiusProperty().asString());

    graphDimensionsCalculator.getCenterNodeIdProperty().addListener(
            (observable, oldValue, newValue) -> nodeId.setText(String.valueOf(newValue)));
    graphDimensionsCalculator.getRadiusProperty().addListener(
            (observable, oldValue, newValue) -> radius.setText(String.valueOf(newValue)));
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:14,代码来源:QuerySettingsController.java

示例6: addItem

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
/**
 * Pokusí se přidat item do slotu.
 * Pokud slot neobsahuje žádný item, tak je vložen celý.
 * Pokud slot obsahuje jiný item, tak se nic nevloží, jinak se pouze přičte počet
 *
 * @param item {@link ItemBase}
 * @param ammount Počet, který se má přidat
 */
public void addItem(ItemBase item, int ammount) {
    if (itemStack == null) {
        itemStack = new ItemStack(item, ammount);
        lblAmmount.textProperty()
            .bindBidirectional(itemStack.ammountProperty(), new NumberStringConverter());
        setImage(item.getImage());
        itemStack.getItem().imageProperty().addListener(imageChangeListener);
        return;
    }

    if (itemStack.containsItemType(item)) {
        itemStack.addAmmount(ammount);
    }
}
 
开发者ID:stechy1,项目名称:drd,代码行数:23,代码来源:ItemSlot.java

示例7: initTextFormater

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public static void initTextFormater(TextField textField, MaxActValue maxActValue) {
    textField.setTextFormatter(new TextFormatter<>(new NumberStringConverter()));
    textField.setTextFormatter(new TextFormatter<>(new NumberStringConverter(), null,
        FormUtils.integerFilter(
            maxActValue.getMinValue().intValue(),
            maxActValue.getMaxValue().intValue()
    )));
    textField.textProperty().bindBidirectional(maxActValue.actValueProperty(), new NumberStringConverter());
}
 
开发者ID:stechy1,项目名称:drd,代码行数:10,代码来源:FormUtils.java

示例8: start

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public void start(Stage stage) throws Exception {
	Customer customer = Customer.createSample(555);
	DirtyState dirtyState = new DirtyState(customer);

	Form form = new Form();
	form.setPadding(new Insets(20));

	Fieldset contactInfo = form.fieldset("Contact Information");

	TextField idInput = new TextField();
	idInput.textProperty().bindBidirectional(customer.idProperty(), new NumberStringConverter());
	contactInfo.field("Id", idInput);

	TextField usernameInput = new TextField();
	usernameInput.textProperty().bindBidirectional(customer.usernameProperty());
	contactInfo.field("Username", usernameInput);

	TextField zipInput = new TextField();
	zipInput.textProperty().bindBidirectional(customer.zipProperty());
	zipInput.setMinWidth(80);
	zipInput.setMaxWidth(80);
	TextField cityInput = new TextField();
	cityInput.textProperty().bindBidirectional(customer.cityProperty());
	contactInfo.field("Zip/City", zipInput, cityInput);

	Button saveButton = new Button("Save");
	saveButton.disableProperty().bind(dirtyState.not());
	saveButton.setOnAction(event -> dirtyState.reset());

	Button undoButton = new Button("Undo");
	undoButton.setOnAction(event -> dirtyState.undo());
	undoButton.visibleProperty().bind(dirtyState);
	contactInfo.field(saveButton, undoButton);

	stage.setScene(new Scene(form, 400,-1));

	stage.show();
}
 
开发者ID:edvin,项目名称:tornadofx-controls,代码行数:39,代码来源:FormDemo.java

示例9: buildTable

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
private TableView<Pojo> buildTable() {
	TableView<Pojo> table = new TableView<>();
	table.setEditable(true);
	table.getItems().addAll(buildPojoList());
	TableColumn<Pojo, String> columnA = new TableColumn<>("ColA");
	TableColumn<Pojo, String> columnB = new TableColumn<>("ColB");
	TableColumn<Pojo, Number> columnC = new TableColumn<>("ColB");
	columnA.setCellValueFactory(new PropertyValueFactory<Pojo, String>("a"));
	columnB.setCellValueFactory(new PropertyValueFactory<Pojo, String>("b"));
	columnC.setCellValueFactory(new PropertyValueFactory<Pojo, Number>("c"));
	columnA.setCellFactory(TextFieldTableCell.forTableColumn());
	columnB.setCellFactory(TextFieldTableCell.forTableColumn());
	columnC.setCellFactory(param -> new TextFieldTableCell<>(new NumberStringConverter()));
	columnA.setOnEditCommit(event -> event.getRowValue().setA(event.getNewValue()));
	columnB.setOnEditCommit(event -> event.getRowValue().setB(event.getNewValue()));
	columnC.setOnEditCommit(event -> event.getRowValue().setC(event.getNewValue().intValue()));
	columnA.setSortable(true);
	columnB.setSortable(true);
	columnC.setSortable(true);
	table.getColumns().add(columnA);
	table.getColumns().add(columnB);
	table.getColumns().add(columnC);
	columnA.prefWidthProperty().bind(table.widthProperty().multiply(0.33));
	columnB.prefWidthProperty().bind(table.widthProperty().multiply(0.33));
	columnC.prefWidthProperty().bind(table.widthProperty().multiply(0.33));

	TableFilter<Pojo> tableFilter = new TableFilter<>(table);
	tableFilter.filterColumn(columnA);
	tableFilter.filterColumn(columnB);
	tableFilter.filterColumn(columnC);

	return table;
}
 
开发者ID:maimArt,项目名称:TableFilterFX,代码行数:34,代码来源:SampleFilteredTable.java

示例10: initialize

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public void initialize() {

    final ObservableList<MsSpectrumType> renderingChoices =
        FXCollections.observableArrayList(MsSpectrumType.CENTROIDED, MsSpectrumType.PROFILE);
    renderingTypeColumn.setCellFactory(ChoiceBoxTableCell.forTableColumn(renderingChoices));

    colorColumn.setCellFactory(column -> new ColorTableCell<MsSpectrumDataSet>(column));

    lineThicknessColumn
        .setCellFactory(column -> new SpinnerTableCell<MsSpectrumDataSet>(column, 1, 5));

    intensityScaleColumn.setCellFactory(TextFieldTableCell.forTableColumn(
        new NumberStringConverter(MZmineCore.getConfiguration().getIntensityFormat())));

    showDataPointsColumn
        .setCellFactory(column -> new CheckBoxTableCell<MsSpectrumDataSet, Boolean>() {
          {
            tableRowProperty().addListener(e -> {
              TableRow<?> row = getTableRow();
              if (row == null)
                return;
              MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem();
              if (dataSet == null)
                return;
              disableProperty()
                  .bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED));

            });
          }
        });
  }
 
开发者ID:mzmine,项目名称:mzmine3,代码行数:32,代码来源:MsSpectrumLayersDialogController.java

示例11: initializeBindings

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
/**
 * initializes the bindings of the sliders and the analysis pane
 */
private void initializeBindings() {
    //First, bind the LoadedData.analyzeAll boolean property to the radio buttons
    LoadedData.analyzeSelectedProperty().bind(compareSelectedSamplesButton.selectedProperty());

    //Since the slider value property is double and the text field property is a string, we need to convert them
    //Defining own class to avoid exceptions
    class MyNumberStringConverter extends NumberStringConverter {
        @Override
        public Number fromString(String value) {
            try {
                return super.fromString(value);
            } catch (RuntimeException ex) {
                return 0;
            }
        }
    }
    StringConverter<Number> converter = new MyNumberStringConverter();
    //Bind every slider to its corresponding text field and vice versa
    Bindings.bindBidirectional(minPosCorrelationText.textProperty(), posCorrelationRangeSlider.lowValueProperty(), converter);
    Bindings.bindBidirectional(maxPosCorrelationText.textProperty(), posCorrelationRangeSlider.highValueProperty(), converter);
    Bindings.bindBidirectional(minNegCorrelationText.textProperty(), negCorrelationRangeSlider.lowValueProperty(), converter);
    Bindings.bindBidirectional(maxNegCorrelationText.textProperty(), negCorrelationRangeSlider.highValueProperty(), converter);
    Bindings.bindBidirectional(maxPValueText.textProperty(), maxPValueSlider.valueProperty(), converter);
    Bindings.bindBidirectional(minFrequencyText.textProperty(), frequencyRangeSlider.lowValueProperty(), converter);
    Bindings.bindBidirectional(maxFrequencyText.textProperty(), frequencyRangeSlider.highValueProperty(), converter);
    Bindings.bindBidirectional(excludeFrequencyText.textProperty(), excludeFrequencySlider.valueProperty(), converter);

    //Bind the internal filter properties to the slider values
    AnalysisData.posCorrelationLowerFilterProperty().bind(posCorrelationRangeSlider.lowValueProperty());
    AnalysisData.posCorrelationUpperFilterProperty().bind(posCorrelationRangeSlider.highValueProperty());
    AnalysisData.negCorrelationLowerFilterProperty().bind(negCorrelationRangeSlider.lowValueProperty());
    AnalysisData.negCorrelationUpperFilterProperty().bind(negCorrelationRangeSlider.highValueProperty());
    AnalysisData.minFrequencyProperty().bind(frequencyRangeSlider.lowValueProperty());
    AnalysisData.maxFrequencyProperty().bind(frequencyRangeSlider.highValueProperty());
    AnalysisData.maxPValueProperty().bind(maxPValueSlider.valueProperty());
    AnalysisData.excludeFrequencyThresholdProperty().bind(excludeFrequencySlider.valueProperty());

    //The values of the negative slider can't be set to values below 0 via FXML for reasons beyond human understanding,
    // so we set them manually
    negCorrelationRangeSlider.setLowValue(-1);
    negCorrelationRangeSlider.setHighValue(-0.5);

    //We want the graph to be redone if one of the following occurs:
    //1. Radio button switches between "Analyze All" and "Analyze Selected"
    compareSelectedSamplesButton.selectedProperty().addListener(observable -> {
        if ((!compareSelectedSamplesButton.isSelected() || LoadedData.getSelectedSamples().size() >= 3)
                && rankChoiceBox.getValue() != null)
            startAnalysis();
    });
    //2. Rank selection changes
    rankChoiceBox.valueProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null && LoadedData.getSamplesToAnalyze().size()>=3) {
            AnalysisData.setLevel_of_analysis(newValue.toLowerCase());
            startAnalysis();
        }
    });
    //3. Sample selection changes while "Analyze Selected" is selected AND at least three samples are selected
    LoadedData.getSelectedSamples().addListener((InvalidationListener) observable -> {
        if (compareSelectedSamplesButton.isSelected() && LoadedData.getSelectedSamples().size() >= 3) {
            startAnalysis();
        }
    });
    //4. Correlation radio button is changed
    pearsonCorrelationButton.selectedProperty().addListener(o -> startAnalysis());
    spearmanCorrelationButton.selectedProperty().addListener(o -> startAnalysis());
    kendallCorrelationButton.selectedProperty().addListener(o -> startAnalysis());
    //5. Global frequency threshold is changed
    excludeFrequencySlider.valueProperty().addListener(o -> startAnalysis());
}
 
开发者ID:jmueller95,项目名称:CORNETTO,代码行数:73,代码来源:MainStageController.java

示例12: initialize

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    terrainName.textProperty().bindBidirectional(terrainProperties.name);
    terrainSize.textProperty().bindBidirectional(terrainProperties.size, new NumberStringConverter());
    terrainLocation.textProperty().bindBidirectional(terrainProperties.location);
}
 
开发者ID:ZoltanTheHun,项目名称:SkyHussars,代码行数:7,代码来源:TerrainEdController.java

示例13: numberFieldFor

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public static TextField numberFieldFor(Property p){
    TextField tf = new TextField();
    tf.textProperty().bindBidirectional(p, new NumberStringConverter());
    return tf;
}
 
开发者ID:ZoltanTheHun,项目名称:SkyHussars,代码行数:6,代码来源:UiHelpers.java

示例14: setStellarObject

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public void setStellarObject(StellarObjectModel stellarObject) {
    this.stellarObject = stellarObject;
    this.epochTextField.getInnerTextField().textProperty().bindBidirectional(stellarObject.epochProperty(), new NumberStringConverter(Locale.ENGLISH, "#.####"));
    this.periodTextField.getInnerTextField().textProperty().bindBidirectional(stellarObject.periodProperty(), new NumberStringConverter(Locale.ENGLISH, "#.##########"));
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:6,代码来源:PhotometricDataOverviewController.java

示例15: createScene

import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public Scene createScene() {
    String basename = getClass().getPackage().getName().replace('.', '/') + "/app";
    URL fxml = getClass().getClassLoader().getResource(basename + ".fxml");
    FXMLLoader fxmlLoader = new FXMLLoader(fxml);
    fxmlLoader.setControllerFactory(param -> AppView.this);
    Parent root = null;
    try {
        root = (Parent) fxmlLoader.load();
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }

    organization.textProperty().addListener((observable, oldValue, newValue) -> {
        model.setState(isBlank(newValue) ? DISABLED : READY);
    });

    model.stateProperty().addListener((observable, oldValue, newValue) ->
        Platform.runLater(() -> {
            switch (newValue) {
                case DISABLED:
                    enabled.setValue(false);
                    running.setValue(false);
                    break;
                case READY:
                    enabled.setValue(true);
                    running.setValue(false);
                    break;
                case RUNNING:
                    enabled.setValue(false);
                    running.setValue(true);
                    break;
            }
        }));

    ObservableList<Repository> items = createJavaFXThreadProxyList(model.getRepositories().sorted());

    repositories.setItems(items);
    EventStreams.sizeOf(items).subscribe(v -> total.setText(String.valueOf(v)));
    organization.textProperty().bindBidirectional(model.organizationProperty());
    bindBidirectional(limit.textProperty(), model.limitProperty(), new NumberStringConverter());
    loadButton.disableProperty().bind(Bindings.not(enabled));
    cancelButton.disableProperty().bind(Bindings.not(running));
    progress.visibleProperty().bind(running);

    Scene scene = new Scene(root);
    scene.getStylesheets().addAll(basename + ".css", "bootstrapfx.css");
    return scene;
}
 
开发者ID:aalmiray,项目名称:javatrove,代码行数:49,代码来源:AppView.java


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