question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ComboBox not setting String array's itens

See original GitHub issue

In 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:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jfoenixadmincommented, Jul 17, 2017

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:

@FXML
private ComboBox<String> estadoBox;
0reactions
jfoenixadmincommented, Jul 18, 2017

My bad I assumed you were using DataFX library, glad the issue is solved.

Regards,

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found