-
JList refresh
Hi,
I'm new here and a new JVA developer too.
I have a JFrame with 3 JComboBox on it.
I need to do a refresh on these JComboBoxes.
The 3 JComboBoxes are initialized with default values....
Then if a select a value on the first JComboBox, values may need to change on the second one.
Here is the code I'm using:
if (fonc.getSelectedIndex() == 1){
String [] combospec = {"DB",
"PROD",
"TEST"};
}
I'm trying to change values on the string array I'm using on second JComboBox, but values never change....I still have default values....
How can I refresh the please ?
Best regards, Pierre.
-
Update the values on the ComboBoxModel.
-
Try learning about events and listeners. You need to listen to the first combo box and respond to its selection changed events by updating the next combo box, and so on.
-
Thanks a lot for your help !!! I will try to do this...:)
BTW, do you have an exemple to see how to use ComboBoxModel please ?
Regards, Pierre.
-
Thanks a lot Steve !!
Can I use the same listener that I'm using for the JButtons(this one works) ?
Or do I have to create a specific one to listen JComboBox ?
Do you have an exemple please ?
Regards, Pierre.
-