0

I want to populate my ComboBox (Jfoenix combo box) when User Click on Combobox to open it.

I linked On Context Menu Requested and On Mouse Clicked methods from SceneBuilder to method below but I checked with debugger and this method is not even invoked when I click on combo box. What should I do to dynamically populate combo box when user click on it to open?

I searched for this and actually didn't find the answer. But it is likely that a similar question exists on StackOverflow. So If you find it, Link to it and I will delete my question.

public void populateComboBox() { //It is linked to OnContextMenuRequested 
    //and OnMouseClicked
    ArrayList<String> deckNames = new ArrayList<>();
    ArrayList<Deck> decks = Account.getLoginedAccount().getCardCollection().getDecks();

    for (int i = 0; i < decks.size(); i++) {
        if (decks.get(i) != null) {
            deckNames.add(decks.get(i).getDeckName());
        }
    }

    listOfDecks_cb.getItems().clear();
    listOfDecks_cb.getItems().addAll(deckNames);

}
Butiri Dan
  • 1,759
  • 5
  • 12
  • 18
amir na
  • 217
  • 1
  • 13

1 Answers1

0

Two concepts RUN and HIDE same as GET and SET
I do not see a setItems()
This loads two Combo Boxes cboFMO and cboTMO

    public void loadMONTHS(){
    ObservableList months = FXCollections.observableArrayList( 
    "January", "Febuary", "March", "April", "May", "June", "July",
    "August","September","October","November","December");
    cboFMO.setItems(months);
    cboTMO.setItems(months);   
}
Vector
  • 3,066
  • 5
  • 27
  • 54