本文整理汇总了Java中javafx.util.converter.DoubleStringConverter类的典型用法代码示例。如果您正苦于以下问题:Java DoubleStringConverter类的具体用法?Java DoubleStringConverter怎么用?Java DoubleStringConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoubleStringConverter类属于javafx.util.converter包,在下文中一共展示了DoubleStringConverter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeTable
import javafx.util.converter.DoubleStringConverter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeTable () {
this.setEditable(true);
this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<IVariable, String> nameColumn = new TableColumn<IVariable, String>("Name");
TableColumn<IVariable, Double> valueColumn = new TableColumn<IVariable, Double>("Value");
// set where to read values from
nameColumn.setCellValueFactory(new PropertyValueFactory<IVariable, String>("name"));
valueColumn.setCellValueFactory(new PropertyValueFactory<IVariable, Double>("value"));
// set editable column (valueColumn)
valueColumn.setCellFactory(TextFieldTableCell
.<IVariable, Double> forTableColumn(new DoubleStringConverter()));
// Set listener to execute when on edit commit runs
valueColumn.setOnEditCommit( (CellEditEvent<IVariable, Double> event) -> setVariableValue(event));
valueColumn.setEditable(true);
this.getColumns().addAll(nameColumn, valueColumn);
}
示例2: initializeTable
import javafx.util.converter.DoubleStringConverter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeTable () {
this.setEditable(true);
this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<Object, String> nameColumn = new TableColumn<Object, String>("Name");
TableColumn<Object, Double> valueColumn = new TableColumn<Object, Double>("Value");
// set where to read values from
nameColumn.setCellValueFactory(new PropertyValueFactory<Object, String>("name"));
valueColumn.setCellValueFactory(new PropertyValueFactory<Object, Double>("value"));
// set editable column (valueColumn)
valueColumn.setCellFactory(TextFieldTableCell.<Object, Double> forTableColumn(new DoubleStringConverter()));
// Set listener to execute when on edit commit runs
valueColumn.setOnEditCommit( (CellEditEvent<Object, Double> event) -> setVariableValue(event));
valueColumn.setEditable(true);
this.getColumns().addAll(nameColumn, valueColumn);
}
示例3: makeInteractivity
import javafx.util.converter.DoubleStringConverter; //导入依赖的package包/类
protected void makeInteractivity() {
// default field values and format
postOfficeStreet.setText(PathController.getWalkingPO().getStreet());
postOfficeCity.setText(PathController.getWalkingPO().getCity());
maxTime.setTextFormatter(new TextFormatter<Double>(new DoubleStringConverter(), PathController.getMaxTime()));
// genBtn disabled state
genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
postOfficeStreet.setOnKeyReleased(e -> {
genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
});
postOfficeCity.setOnKeyReleased(e -> {
genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
});
maxTime.setOnKeyReleased(e -> {
genBtn.setDisable(postOfficeStreet.getLength() == 0 || postOfficeCity.getLength() == 0 || maxTime.getLength() == 0);
});
// genBtn action
genBtn.setOnAction(e -> {
PathController.setPostOffice(new Shipment(postOfficeStreet.getText(), postOfficeCity.getText(), false));
PathController.setMaxTime(Double.parseDouble(maxTime.getText()));
PathController.generate();
PathController.display();
});
// wView config
wView.getEngine().load("https://www.google.fr/maps");
}
示例4: createVisualisation
import javafx.util.converter.DoubleStringConverter; //导入依赖的package包/类
@Override
public Node createVisualisation(SimpleObjectProperty<Double> boundTo, boolean readonly) {
TextField textField = new TextField();
TypedTextFieldHelper.setupDoubleTextField(textField);
textField.textProperty().bindBidirectional(boundTo, new DoubleStringConverter());
textField.setEditable(!readonly);
return textField;
}
示例5: buildOptionPane
import javafx.util.converter.DoubleStringConverter; //导入依赖的package包/类
/**
* Create a block of niche options - specifically International Dateline cropping and whether
* there should be a graticule
* @param cropAtIDL The mutable boolean value to which to bind the "Crop at Dateline" CheckBox
* @param graticule The mutable double value to which to bind the "Graticule" Spinner
* @return the full formatted Region
*/
protected Region buildOptionPane(Flag cropAtIDL, MutableDouble graticule) {
final CheckBox cropBox = new CheckBox("Crop at International Dateline"); //the CheckBox for whether there should be shown imagery outside the International Dateline
cropBox.setSelected(cropAtIDL.isSet());
cropBox.setTooltip(new Tooltip("Show every point exactly once."));
cropBox.selectedProperty().addListener((observable, old, now) -> {
cropAtIDL.set(now);
});
final ObservableList<Double> factorsOf90 = FXCollections.observableArrayList();
for (double f = 1; f <= 90; f += 0.5)
if (90%f == 0)
factorsOf90.add((double)f);
final Spinner<Double> gratSpinner = new Spinner<Double>(factorsOf90); //spinner for the graticule value
gratSpinner.getValueFactory().setConverter(new DoubleStringConverter());
gratSpinner.getValueFactory().setValue(graticule.get());
gratSpinner.setDisable(graticule.isZero());
gratSpinner.setEditable(true);
gratSpinner.setTooltip(new Tooltip("The spacing in degrees between shown parallels and meridians."));
gratSpinner.setPrefWidth(SPINNER_WIDTH);
gratSpinner.valueProperty().addListener((observable, old, now) -> {
graticule.set(now); //which is tied to the mutable graticule spacing variable
});
final CheckBox gratBox = new CheckBox("Graticule: "); //the CheckBox for whether there should be a graticule
gratBox.setSelected(!graticule.isZero());
gratBox.setTooltip(new Tooltip("Overlay a mesh of parallels and meridians."));
gratBox.selectedProperty().addListener((observable, old, now) -> {
if (now)
graticule.set(gratSpinner.getValue()); //set the value of graticule appropriately when checked
else
graticule.set(0); //when not checked, represent "no graticule" as a spacing of 0
gratSpinner.setDisable(!now); //disable the graticule Spinner when appropriate
});
final HBox gratRow = new HBox(H_SPACE, gratBox, gratSpinner);
gratRow.setAlignment(Pos.CENTER_LEFT);
return new VBox(V_SPACE, cropBox, gratRow);
}
示例6: initialize
import javafx.util.converter.DoubleStringConverter; //导入依赖的package包/类
public void initialize(URL location, ResourceBundle resources) {
wrapAt.textProperty().bindBidirectional(responsiveFieldset.wrapWidthProperty(), new DoubleStringConverter());
}