🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #416

Re: ActionEvent on a JComboBox problem

#416
From: tech
Date: Fri, 02 Jul 1999 00:00
39 lines
2219 bytes
This is interesting. I always thought that the ActionEvent is not called
when programatically changing the seletion. I thought that only
SelectionChanged events are fired.  In fact I had to use ActionEvent
instead of selection event to avoid a loop (I was updating the
gui). But then I may be confusing this with awt List/Choice/Combobox

-sandip


In article <377CF6DE.3049A54A@terren.com>,
  Stan Reinis <stan@terren.com> wrote:
> We have a JComboBox on a JPanel.
>
> We need to call a method when the user changes the selected item
> in the combobox.  We have been using ActionEventListener to
> accomplish this.  However, if the combobox already has a value
> assigned to it when the panel is opened, we do not want to call
> this event.  Unfortunately (for us), an ActionEvent is fired when
> we programatically set the value in the combobox.
>
> To overcome this, we added a boolean that is set to false just before
> we programatically change the value in the combobox.  Then we change
> it back.
>
> Occasionally it happens that the Action is processed before the
boolean
> changes.  Apparently Actions are run on a different thread than the
> main execution, which causes a race condition.
>
> What can we do here?
>
> Stan
> Terren Corporation
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID: <7ljc4e$nla$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <377CF6DE.3049A54A@terren.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,a7b460689038b6b9
X-Google-Attributes: gid113ae9,public
X-Google-Thread: f74b3,a7b460689038b6b9
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 10a146,a7b460689038b6b9
X-Google-Attributes: gid10a146,public
From: tech <chitale@my-deja.com>
Subject: Re: ActionEvent on a JComboBox problem
Date: 1999/07/02
Message-ID: <7ljc4e$nla$1@nnrp1.deja.com>
X-Deja-AN: 496547717
References: <377CF6DE.3049A54A@terren.com>
X-Http-Proxy: 1.0 x27.deja.com:80 (Squid/1.1.22) for client 206.79.179.70
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Fri Jul 02 21:49:05 1999 GMT
Newsgroups: comp.lang.java.programmer,comp.lang.java.help,borland.public.jbuilder.java.language
X-Http-User-Agent: Mozilla/4.51 [en] (WinNT; I)