Article View: comp.lang.java.programmer
Article #414ActionEvent on a JComboBox problem
From: Stan Reinis
Date: Fri, 02 Jul 1999 00:00
Date: Fri, 02 Jul 1999 00:00
21 lines
1527 bytes
1527 bytes
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
Technical Details
Message-ID:
<377CF6DE.3049A54A@terren.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,a7b460689038b6b9,start X-Google-Attributes: gid10a146,public X-Google-Thread: 113ae9,a7b460689038b6b9,start X-Google-Attributes: gid113ae9,public X-Google-Thread: f74b3,a7b460689038b6b9,start X-Google-Attributes: gidf74b3,public From: Stan Reinis <stan@terren.com> Subject: ActionEvent on a JComboBox problem Date: 1999/07/02 Message-ID: <377CF6DE.3049A54A@terren.com> X-Deja-AN: 496490437 Content-Transfer-Encoding: 7bit Organization: Terren Corporation X-Accept-Language: cs,ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.java.programmer,comp.lang.java.help,borland.public.jbuilder.java.language