Making combo boxes update
Right so I have a s开发者_StackOverflow中文版imple problem, I have three combo boxes and a method that chooses a new array value for the 3rd combo box.
How do I make the 3rd combo box update when I use the first two combo boxes result to create a new array for the 3rd combo box.
This has to happen in real time so combo box 3 has to update every time 1 or 2 updates ( I assume I add them to the action performed but I haven't had any luck ).
PS. I'm doing this with swings JComboBoxes
thanks in advance.
You need to add EventListeners to the first two combo boxes which will be notified when the combo boxes change. This event could then be used to do whatever modifications you need to the third combo box.
This page will explain to you all the details of EventListeners: http://download.oracle.com/javase/tutorial/uiswing/events/index.html
精彩评论