List of usage examples for javafx.scene.control ComboBox selectionModelProperty
public final ObjectProperty<SingleSelectionModel<T>> selectionModelProperty()
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.selectionModelProperty()); GridPane grid = new GridPane(); grid.setVgap(4);/*from w w w . j a v a2 s . c o 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(); }
From source file:mesclasses.controller.PageController.java
public final void markAsMandatory(ComboBox box) { box.selectionModelProperty().addListener((observable, oldValue, newValue) -> { checkMandatory(box);/*from ww w . j a v a 2s . co m*/ }); }