Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3096

Re: Two JComboBoxes One c

From "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this>
Subject Re: Two JComboBoxes One c
Message-ID <fnpip6$qcn$1@aioe.org> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:42 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui,comp.l
On 30.01.2008 10:46, Roedy Green allegedly wrote:
> On Mon, 28 Jan 2008 12:59:25 -0500, RC <raymond.chui@nospam.noaa.gov>
>  wrote, quoted or indirectly quoted someone who said :
> 
>> 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.

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

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread


Thread

Re: Two JComboBoxes One c "Daniele Futtorovic" <daniele.futtorovic@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000

csiph-web