Chris Tompkinson
Chris Tompkinson

Reputation: 23

Making combo boxes update

Right so I have a simple 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.

Upvotes: 2

Views: 1320

Answers (1)

Kevin Dolan
Kevin Dolan

Reputation: 5097

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

Upvotes: 2

Related Questions