...
> Any idea how to do that?
Did you try reading the documentation?
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/
JComboBox.html#setSelectedIndex(int)>
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/
JComboBox.html#setSelectedItem(java.lang.Object)>
The 1.4 JDcos were the first Google found.
I expect the 1.6 docs will say the same.
(F/U set to c.l.j.h. only)
--
Andrew T.
PhySci.org
> I have two JComboBoxes
>
[quoted text clipped - 11 lines]
>
> Thank Q in advance!
hi
your question is quite intresting.............you want to use to
associated events & both are inter related ........................so
you must serialize them.........i thing its better to use boolean
variable to serialize events ......................
thanks
>Vice versa, if combo2 itemStateChanged, then combo1 also
>itemStateChanged.
>
>Any idea how to do that?
Use a listener that sets the state of the other. the problem is you
get fibrillation, where each change triggers another, ad-infinitum.
So you must set a boolean somewhere to say, "ignore trigger"
When you get a trigger you check the boolean. If it says ignore, you
set it false and do nothing. If it is false you set it true and
trigger the other widget.

Signature
Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com
Daniele Futtorovic - 30 Jan 2008 10:16 GMT
>> Vice versa, if combo2 itemStateChanged, then combo1 also
>> itemStateChanged.
[quoted text clipped - 9 lines]
> set it false and do nothing. If it is false you set it true and
> trigger the other widget.
Depends on whether the relationship between his two models is bijective,
though, that is whether any item of any of the two models is mapped to
exactly one of the other model. If it is, it should work alright, since
calling setSelectedItem with the currently selected item (may be null)
doesn't fire any ItemEvent (though it does fire an ActionEvent).
Follow-up to c.l.j.g