Hello good day.
I am having trouble letting my listeners wait on each other.
I have a
- JList - groups
- JList - students
The choice from the JComboBox, clears and updates the groups JList by way of an actionlistener. The ListSelectionListener for the groups JList, then responds to you selecting data (that was just added). The choice is refelcted in the students JList.
The trouble is I am getting a NullPointerException at random times. I believe this happens because in order to update the groups-JList via the ComboBox's ActionListener, I need to clear it's contents first. But this seems to trigger its ListSelectionListener. The trouble is that this trigger happens when it is cleared - so there's nothing in the JList and so when the ListSelectionListener runs, it is working with an empty list thus the NullPointerException.....whew.(I hope that was clear)
Please is there some way to let the Listeners wait on each other; one going only after the other is completed?