ComboBox not setting String array's itens
See original GitHub issueIn JavaFX I ever set the items like this:
@FXML public void initialize() { // Carregando lista de estados na Box. estadoBox.setItems(FXCollections.observableArrayList(estados)); }
but whit JFoenix API I don’t have success, look my code:
`…
@FXML
private ComboBox<String> estadoBox = new ComboBox<String>();
…
private String estados[] = {“AC”, “AL”, “AP”, “AM”, “BA”, “CE”, “DF”, “ES”, “GO”, “MA”, “MT”, “MS”, “MG”, “PA”, “PB”, “PR”, “PE”, “PI”, “RJ”, “RN”, “RS”, “RO”, “RR”, “SC”, “SE”, “TO”}; …
@FXML public void initialize() { // Carregando lista de estados na Box. estadoBox.setItems(FXCollections.observableArrayList(estados)); }
…`
after this the comboBox yet is void.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
How can I add array values into a combobox? - Stack Overflow
You can add an array of strings using method AddRange(array[]) from comboBox . form.comboBox1.Items.AddRange(type);.
Read more >set combobox.datasource to string array - MSDN - Microsoft
hi, i have a simple string array that i databind with a combo box, ... left with no option but to manually fill...
Read more >How to Use Combo Boxes - Oracle Help Center
This combo box contains an array of strings, but you could just as easily use icons instead ... If the user chooses the...
Read more >[Solved]-How can I add array values into a combobox?-C#
If you want the items to be in the ComboBox just set the array as its datasource. You don't need to loop through...
Read more >Solved: Select combo box from string/array - NI Community
The combobox items can be updated programmatically by writing a 1D array of strings to the Strings[] property.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
after having a second look at the code you provided, it seems you are creating a new combo instead of using the one retrieved from fxml which is wrong. The declaration of combo box field should be as the following:
My bad I assumed you were using DataFX library, glad the issue is solved.
Regards,