I have two combobox in a form, it depends on the first option of the first combo, you must load the results referring to the first option, for example, if I choose the option of Sección 1
in my first combo, you must load all the referenced employees to that section in the second combo, to some extent it does, the problem is in the combo method of ItemStateChanged
which is next. way:
private void cmbo2ItemStateChanged(java.awt.event.ItemEvent evt)
{
empList2 = (DplyEmpl)cmbo2.getSelectedItem();
cmbId2 = empList2.dplyMmbr.toString();
idCmb2 = Integer.parseInt(empList2.vlMmbr.toString());
}
In this previous method, what I do is that I take the name of the employee and bring from a list called DplyEmpl
the value of their ID to be able to make more queries. If I remove that code, it works fine when displaying the lists, but it does not take any value from the combo.
In the combo where I updated depending on the section is the following:
private void comboSections2ItemStateChanged(java.awt.event.ItemEvent evt) {
section = comboSections2.getSelectedItem().toString();
if(cmbo2 != null)
{
cmbo2.removeAllItems();
cnslt.UpdtCmbEmplysBySctn(cmbo2, section);//Metodo que actualiza el ComboBox
}
}
The problem begins in that if I leave the first code of the cmbo2ItemStateChanged
, it shows nothing and remains blank, if someone could tell me where my error is, or some way to make it easier, since I have looked for ways different but in many come to do the same.