I want to know how to add the drivers already created to the taxi registration ComboBox and select a driver and then add the taxi
A colleague told me that I could include this code in the override and it would work for me but it still doesn't work.
for (Iterator<Conductor> iterator = lista.iterator(); iterator.hasNext();) {
Conductor next = iterator.next();
comboBox.getItems().add(next.getNombre());
}
If your
JComboBox
is already created, create an array of String elements from your list, use the methodsetModel()
to populate it:The type variable is declared
comboBox
Then we carry out the following method that fills the
ComboBox
, it is important that it receives a type parameterJComboBox
Then, within the method that starts all the components of the window, the method is called and the driver
rellenarComboConductores()
is passed as a parameter .combobox