Example usage for javafx.scene.control ComboBox converterProperty

List of usage examples for javafx.scene.control ComboBox converterProperty

Introduction

In this page you can find the example usage for javafx.scene.control ComboBox converterProperty.

Prototype

public ObjectProperty<StringConverter<T>> converterProperty() 

Source Link

Document

Converts the user-typed input (when the ComboBox is #editableProperty() editable ) to an object of type T, such that the input may be retrieved via the #valueProperty() value property.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>(list);

    emailComboBox.setValue("A");
    System.out.println(emailComboBox.converterProperty());

    GridPane grid = new GridPane();
    grid.setVgap(4);/*  w  w  w  .  jav  a  2  s  . co  m*/
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}