本文整理汇总了Java中javafx.util.converter.NumberStringConverter类的典型用法代码示例。如果您正苦于以下问题:Java NumberStringConverter类的具体用法?Java NumberStringConverter怎么用?Java NumberStringConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumberStringConverter类属于javafx.util.converter包,在下文中一共展示了NumberStringConverter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: initNavigationPane
import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
private void initNavigationPane() {
//region *** Buttons ***
backButton.setOnAction(this::handleHistoryBack);
forwardButton.setOnAction(this::handleHistoryForward);
refreshButton.setOnAction(this::handleRefresh);
snapshotButton.setOnAction(this::handleTakeSnapshot);
forwardButton.setOnAction(this::handleHistoryForward);
backButton.disableProperty().bind(backwardHistory.emptyStackProperty);
forwardButton.disableProperty().bind(forwardHistory.emptyStackProperty);
//endregion
//region *** Time pickers ***
this.currentState = new XYChartViewState(getWorksheet().getFromDateTime(), getWorksheet().getToDateTime(), 0, 100);
getWorksheet().fromDateTimeProperty().bind(currentState.startX);
getWorksheet().toDateTimeProperty().bind(currentState.endX);
plotChart(currentState.asSelection(), true);
endDate.zoneIdProperty().bind(getWorksheet().timeZoneProperty());
startDate.zoneIdProperty().bind(getWorksheet().timeZoneProperty());
startDate.dateTimeValueProperty().bindBidirectional(currentState.startX);
endDate.dateTimeValueProperty().bindBidirectional(currentState.endX);
//endregion
//region *** Crosshair ***
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.RFC_1123_DATE_TIME;// DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.MEDIUM);
NumberStringConverter numberFormatter = new NumberStringConverter(Locale.getDefault(Locale.Category.FORMAT));
crossHair = new XYChartCrosshair<>(chart, chartParent, dateTimeFormatter::format, n -> String.format("%,.2f", n.doubleValue()));
crossHair.onSelectionDone(s -> {
logger.debug(() -> "Applying zoom selection: " + s.toString());
currentState.setSelection(s, true);
});
hCrosshair.selectedProperty().bindBidirectional(globalPrefs.horizontalMarkerOnProperty());
vCrosshair.selectedProperty().bindBidirectional(globalPrefs.verticalMarkerOnProperty());
crossHair.horizontalMarkerVisibleProperty().bind(Bindings.createBooleanBinding(() -> globalPrefs.isShiftPressed() || hCrosshair.isSelected(), hCrosshair.selectedProperty(), globalPrefs.shiftPressedProperty()));
crossHair.verticalMarkerVisibleProperty().bind(Bindings.createBooleanBinding(() -> globalPrefs.isCtrlPressed() || vCrosshair.isSelected(), vCrosshair.selectedProperty(), globalPrefs.ctrlPressedProperty()));
currentColumn.setVisible(crossHair.isVerticalMarkerVisible());
crossHair.verticalMarkerVisibleProperty().addListener((observable, oldValue, newValue) -> currentColumn.setVisible(newValue));
setAndBindTextFormatter(yMinRange, numberFormatter, currentState.startY, ((ValueAxis<Double>) chart.getYAxis()).lowerBoundProperty());
setAndBindTextFormatter(yMaxRange, numberFormatter, currentState.endY, ((ValueAxis<Double>) chart.getYAxis()).upperBoundProperty());
//endregion
}
开发者ID:fthevenet,项目名称:binjr,代码行数:42,代码来源:WorksheetController.java
示例17: initialize
import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
public void initialize(java.net.URL location, java.util.ResourceBundle resources) {
preferences = Preferences.userNodeForPackage(this.getClass());
replayController = new ReplayController();
BooleanBinding runnerIsNull = Bindings.createBooleanBinding(() -> replayController.getRunner() == null, replayController.runnerProperty());
buttonPlay.disableProperty().bind(runnerIsNull.or(replayController.playingProperty()));
buttonPause.disableProperty().bind(runnerIsNull.or(replayController.playingProperty().not()));
slider.disableProperty().bind(runnerIsNull);
replayController.changingProperty().bind(slider.valueChangingProperty());
labelTick.textProperty().bindBidirectional(replayController.tickProperty(), new NumberStringConverter());
labelLastTick.textProperty().bindBidirectional(replayController.lastTickProperty(), new NumberStringConverter());
slider.maxProperty().bind(replayController.lastTickProperty());
replayController.tickProperty().addListener((observable, oldValue, newValue) -> {
if (!slider.isValueChanging()) {
slider.setValue(newValue.intValue());
}
});
slider.valueProperty().addListener((observable, oldValue, newValue) -> {
replayController.getRunner().setDemandedTick(newValue.intValue());
});
TableColumn<ObservableEntity, String> entityTableIdColumn = (TableColumn<ObservableEntity, String>) entityTable.getColumns().get(0);
entityTableIdColumn.setCellValueFactory(param -> param.getValue() != null ? param.getValue().indexProperty() : new ReadOnlyStringWrapper(""));
TableColumn<ObservableEntity, String> entityTableNameColumn = (TableColumn<ObservableEntity, String>) entityTable.getColumns().get(1);
entityTableNameColumn.setCellValueFactory(param -> param.getValue() != null ? param.getValue().nameProperty() : new ReadOnlyStringWrapper(""));
entityTable.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
log.info("entity table selection from {} to {}", oldValue, newValue);
detailTable.setItems(newValue);
});
TableColumn<ObservableEntityProperty, String> idColumn =
(TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(0);
idColumn.setCellValueFactory(param -> param.getValue().indexProperty());
TableColumn<ObservableEntityProperty, String> nameColumn =
(TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(1);
nameColumn.setCellValueFactory(param -> param.getValue().nameProperty());
TableColumn<ObservableEntityProperty, String> valueColumn =
(TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(2);
valueColumn.setCellValueFactory(param -> param.getValue().valueProperty());
entityNameFilter.textProperty().addListener(observable -> {
if (filteredEntityList != null) {
filteredEntityList.setPredicate(allFilterFunc);
filteredEntityList.setPredicate(filterFunc);
}
});
mapControl = new MapControl();
mapCanvasPane.getChildren().add(mapControl);
mapCanvasPane.setTopAnchor(mapControl, 0.0);
mapCanvasPane.setBottomAnchor(mapControl, 0.0);
mapCanvasPane.setLeftAnchor(mapControl, 0.0);
mapCanvasPane.setRightAnchor(mapControl, 0.0);
mapCanvasPane.widthProperty().addListener(evt -> resizeMapControl());
mapCanvasPane.heightProperty().addListener(evt -> resizeMapControl());
}
开发者ID:spheenik,项目名称:clarity-analyzer,代码行数:61,代码来源:MainPresenter.java
示例18: initialize
import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
@FXML
public void initialize() {
NumberFormat xAxisFormatter;
if (xAxis instanceof NumberAxis)
xAxisFormatter = ((NumberAxis) xAxis).getNumberFormatOverride();
else
xAxisFormatter = NumberFormat.getNumberInstance();
NumberFormat yAxisFormatter;
if (yAxis instanceof NumberAxis)
yAxisFormatter = ((NumberAxis) yAxis).getNumberFormatOverride();
else
yAxisFormatter = NumberFormat.getNumberInstance();
xAxisLabel.setText(xAxis.getLabel());
yAxisLabel.setText(yAxis.getLabel());
xAxisRangeMin.setTextFormatter(new TextFormatter<>(new NumberStringConverter(xAxisFormatter)));
xAxisRangeMin.disableProperty().bind(xAxisAutoRange.selectedProperty());
xAxisRangeMin.setText(String.valueOf(xAxis.getLowerBound()));
xAxisRangeMax.setTextFormatter(new TextFormatter<>(new NumberStringConverter(xAxisFormatter)));
xAxisRangeMax.disableProperty().bind(xAxisAutoRange.selectedProperty());
xAxisRangeMax.setText(String.valueOf(xAxis.getUpperBound()));
xAxisAutoRange.setSelected(xAxis.isAutoRange());
yAxisRangeMin.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter)));
yAxisRangeMin.setText(String.valueOf(yAxis.getLowerBound()));
yAxisRangeMin.disableProperty().bind(yAxisAutoRange.selectedProperty());
yAxisRangeMax.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter)));
yAxisRangeMax.setText(String.valueOf(yAxis.getUpperBound()));
yAxisRangeMax.disableProperty().bind(yAxisAutoRange.selectedProperty());
yAxisAutoRange.setSelected(yAxis.isAutoRange());
xAxisTickSize.disableProperty().bind(xAxisAutoTickSize.selectedProperty());
xAxisTickSize.setText(String.valueOf(xAxis.getTickUnit().getSize()));
xAxisAutoTickSize.setSelected(xAxis.isAutoTickUnitSelection());
yAxisTickSize.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter)));
yAxisTickSize.setText(String.valueOf(yAxis.getTickUnit().getSize()));
yAxisTickSize.disableProperty().bind(yAxisAutoTickSize.selectedProperty());
yAxisAutoTickSize.setSelected(yAxis.isAutoTickUnitSelection());
}
开发者ID:mzmine,项目名称:mzmine3,代码行数:45,代码来源:ManualZoomDialog.java
示例19: generate
import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
/** Generate button event handler */
@FXML public void generate() {
// Artificial Value Generation pop-up menu
final Stage options = new Stage();
options.initModality(Modality.APPLICATION_MODAL);
options.initOwner(mainApp.getStage());
HBox optionsBox = new HBox(10);
optionsBox.setPadding(new Insets(10, 15, 10, 15));
Button ok = new Button("OK");
Label amountOfRowsLabel = new Label("Amount of row: ");
// Artificial Value Generation Slider
final Slider amountOfRows = new Slider(0, 500, 1);
amountOfRows
.valueProperty()
.addListener((obs, oldVal, newVal) -> amountOfRows.setValue(newVal.intValue()));
amountOfRows.setShowTickLabels(true);
amountOfRows.setShowTickMarks(true);
amountOfRows.setMajorTickUnit(50);
amountOfRows.setMinorTickCount(5);
TextField amountOfRowsValue = new TextField(String.valueOf(amountOfRows.getValue()));
amountOfRowsValue.textProperty().bindBidirectional(amountOfRows.valueProperty(),
new NumberStringConverter());
optionsBox.getChildren().add(amountOfRowsLabel);
optionsBox.getChildren().add(amountOfRows);
optionsBox.getChildren().add(amountOfRowsValue);
optionsBox.getChildren().add(ok);
Scene optionScene = new Scene(optionsBox, 600, 60);
options.setResizable(false);
options.setTitle("Artificial Value Generation");
options.setScene(optionScene);
options.show();
resultText.appendText("\nArtificial values have been generated\n");
// Artificial Value Generation Event Handler
ok.setOnAction(e -> {
realLayersFeatures.clear();
for (int i = 0; i < Math.round(amountOfRows.getValue()); i++) {
double sponginess = ArtificialValueGenerator.getRandom3Sigma();
double amountOfClay = ArtificialValueGenerator.getRandom3Sigma();
double amountOfCarbonate = ArtificialValueGenerator.getRandom3Sigma();
double vPAmplitude = ArtificialValueGenerator.getRandom3Sigma();
realLayersFeatures.add(new RealLayerFeatures(i+1, sponginess,
amountOfClay, amountOfCarbonate, vPAmplitude));
options.close();
}
});
}
开发者ID:Saka7,项目名称:Layer-Classifier,代码行数:55,代码来源:AppController.java
示例20: initialize
import javafx.util.converter.NumberStringConverter; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
ProtocolConfiguration prop = con.getConfiguration();
historyList.setItems(ctx.getHistory());
clearBtn.setOnAction(a -> historyList.getItems().clear());
securityCombo.getItems().addAll(FXCollections.observableArrayList(SecurityType.NONE, SecurityType.VNC_Auth));
securityCombo.getSelectionModel().selectedItemProperty().addListener((l, a, b) -> {
prop.securityProperty().set(b != null ? b : SecurityType.UNKNOWN);
});
pwdField.disableProperty().bind(Bindings.equal(SecurityType.NONE, securityCombo.getSelectionModel().selectedItemProperty()));
prop.hostProperty().bindBidirectional(ipField.textProperty());
StringConverter<Number> converter = new NumberStringConverter("#");
Bindings.bindBidirectional(portField.textProperty(), prop.portProperty(), converter);
prop.passwordProperty().bindBidirectional(pwdField.textProperty());
prop.sslProperty().bindBidirectional(sslCB.selectedProperty());
prop.sharedProperty().bindBidirectional(sharedCB.selectedProperty());
forceRfb33CB.setSelected(prop.versionProperty().get() == ProtocolVersion.RFB_3_3);
forceRfb33CB.selectedProperty().addListener((l, a, b) -> prop.versionProperty().set(b ? ProtocolVersion.RFB_3_3 : ProtocolVersion.RFB_3_8));
listeningCB.selectedProperty().bindBidirectional(con.listeningModeProperty());
Bindings.bindBidirectional(listeningPortField.textProperty(), con.listeningPortProperty(), converter);
listeningPortField.disableProperty().bind(listeningCB.selectedProperty().not());
prop.rawEncProperty().bindBidirectional(rawCB.selectedProperty());
prop.copyRectEncProperty().bindBidirectional(copyrectCB.selectedProperty());
prop.hextileEncProperty().bindBidirectional(hextileCB.selectedProperty());
prop.clientCursorProperty().bindBidirectional(cursorCB.selectedProperty());
prop.desktopSizeProperty().bindBidirectional(desktopCB.selectedProperty());
prop.zlibEncProperty().bindBidirectional(zlibCB.selectedProperty());
portField.textProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null && !newValue.isEmpty() && !newValue.matches("[0-9]+")) {
if (!oldValue.matches("[0-9]+")) {
((StringProperty) observable).setValue("");
return;
}
((StringProperty) observable).setValue(oldValue);
}
});
con.connectingProperty().addListener((l, a, b) -> Platform.runLater(() -> ipField.getParent().setDisable(b)));
ctx.bind(ipField.textProperty(), "hostField");
ctx.bind(portField.textProperty(), "portField");
ctx.bind(userField.textProperty(), "userField");
ctx.bind(pwdField.textProperty(), "pwdField");
ctx.bind(securityCombo, "authType");
ctx.bind(sslCB.selectedProperty(), "useSSL");
ctx.bind(sharedCB.selectedProperty(), "useSharedView");
ctx.bind(forceRfb33CB.selectedProperty(), "forceRfb33");
ctx.bind(listeningCB.selectedProperty(), "listeningMode");
ctx.bind(listeningPortField.textProperty(), "listeningPortField");
ctx.bind(rawCB.selectedProperty(), "useRaw");
ctx.bind(copyrectCB.selectedProperty(), "useCopyRect");
ctx.bind(hextileCB.selectedProperty(), "useHextile");
ctx.bind(cursorCB.selectedProperty(), "useCursor");
ctx.bind(desktopCB.selectedProperty(), "useDesktopSize");
ctx.bind(zlibCB.selectedProperty(), "useZlib");
if (securityCombo.getSelectionModel().getSelectedIndex() < 0) {
securityCombo.getSelectionModel().select(SecurityType.VNC_Auth);
}
historyList.getSelectionModel().selectedItemProperty().addListener((l, a, b) -> updateData(b));
con.connectInfoProperty().addListener((l, a, b) -> Platform.runLater(() -> addToHistory(b)));
}
开发者ID:comtel2000,项目名称:jfxvnc,代码行数:74,代码来源:ConnectViewPresenter.java
注:本文中的javafx.util.converter.NumberStringConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论