Skip to content

Why does my combobox selectedItem doesnt work? [closed]

I don’t know why this line has an error

String selected = idCombo.GetItemText(idCombo.SelectedItem);

The compilation error is "SelectedItem cannot be resolved or is not a field"


You code looks like a C# code. In Java, you have to call idCombo.getSelectionModel().getSelectedItem() instead of idCombo.GetItemText(idCombo.SelectedItem).