Reputation: 279
All the solutions I've read relate to ComboBox, not CheckComboBox. Using the ControlsFX CheckComboBox
I've been able to add a few options into it using the controller code below. But I can't figure out how to pre-check an option at the time its added to the ArrayList
, nor set Prompt Text.
...
@FXML
public CheckComboBox<String> extras;
@Override
public void initialize(URL location, ResourceBundle resources) {
extras.getItems().add("A");
extras.getItems().add("B");
...
There doesn't seem to be a method like: extras.getItems().add("A", true);
or extras.getItems().get(0).setValue(true);
The answer found here uses something like below, but this won't work for CheckComboBox
:
extras.setValue(value);
and
extras.setPromptText("Prompt Text");
Which leaves me asking:
CheckComboBox
?Upvotes: 3
Views: 2479
Reputation: 1163
The equivalent property for the "prompt test" is the "title":
checkComboBox.setTitle("myTitle");
Upvotes: 1
Reputation: 732
I hope this code will help you..
checkComboBox.getCheckModel().check(0);
Upvotes: 0