Well I have a problem and I want to load a ComboBox
with data returned by a database and here everything is fine. The thing is that when executing the method which would fill the ComboBox
throw compile error.
This is the error: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
public class FXMLDocumentRegisterController implements Initializable {
@FXML
private JFXComboBox<String> CmbCountry;
@Override
public void initialize(URL url, ResourceBundle rb) {
loadCmb();//aca ejecuto el metodo de carga del combobox
}
private void loadCmb(){//este metodo carga el combobox con los datos devueltos de la base de datos
RepoPais repo = FabricaReposSQL.CrearRepoPais();
Iterable<Pais> p = repo.FindAll(); for (Pais pais : p) {
CmbCountry.getItems().add(pais.Nombre);
}
}
}
The error occurs in the line where the Item is added to the ComboBox: CmbCountry.getItems().add(pais.Nombre);
I hope you can help me thank you very much:)