本文整理汇总了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);
}
示例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());
}
}
示例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());
}
示例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());
}
示例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)));
}
示例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);
}
}
示例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());
}
示例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();
}
示例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;
}
示例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));
});
}
});
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}