Combobox values do not appear for selection

Asked

Viewed 150 times

1

I would like the help of you on the following question!! I have a combobox and want to fill it with whole numbers. It happens that when I run the program nothing appears for me to select!... Follow the code:

 ObservableList<Integer> options
            = FXCollections.observableArrayList(1, 2, 3);
 comboboxQuantCam.setItems(options);

1 answer

1


Your code is right, except the object that wasn’t built:

Combobox comboboxQuantCam = new Combobox();

Would look like this:

     ObservableList<Integer> options

        = FXCollections.observableArrayList(1, 2, 3);

     ComboBox comboboxQuantCam = new ComboBox();

     comboboxQuantCam.setItems(options);

    seuLayout.getChildren().addAll(comboboxQuantCam);
  • Hello Carlos Ximendes, Good afternoon! Thank you so much for your help!. Actually I built the object, it turns out that the id in Scenebuilder was wrong: <Combobox fx:id="comboboxEqUm" But thank you so much for your attention :)!

  • Thank you, Sara Fernandes!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.