🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2201

Re: Combo Box ItemStateChange -- Seems to Fire 2X Per Change!

#2201
From: Harry Whitehouse
Date: Mon, 23 Apr 2001 21:21
50 lines
2380 bytes
Torsten --

Beautiful!!  Thanks!!

Harry


"Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message
news:3ae3de4a$1_1@dnews...
>
> Harry,
>
> it works as designed - you get one DESELECTED event for the
> former and one SELECTED event for the new selcected item.
> You can use ItemEvent.getStateChange() to distinguish the two
> events.
>
> Torsten
>
> "Harry Whitehouse" <harry@envmgr.com> wrote:
> >I must be missing a simple, basic concept WRT JComboBoxes.  I have an
applet
> >which instantiates one combobox...
> >
> >JComboBox jComboBoxMailingType = new JComboBox();
> >
> >I add and item listener, and populate the combobox with a few selections.
> >
> > jComboBoxMailingType.addItemListener(new java.awt.event.ItemListener() {
> >      public void itemStateChanged(ItemEvent e) {
> >        jComboBoxMailingType_itemStateChanged(e);
> >      }
> >    });
> >
> >
> >I've chosen to listen for itemStateChanged()  which invokes a process....
> >
> >void jComboBoxMailingType_itemStateChanged(ItemEvent e) {
> >    DoSomeProcess();
> >}
> >
> >Now the curious thing is I enter the event handler TWICE whenever I
change
> >the combobox selection.  I'd expect to enter this handler function once
per
> >change in selection.
> >
> >Baiscally, I want to DoSomeProcess() once when the combobox selection
> >changes to a new value.   Can someone point out what I'm missing here?
>
Technical Details
Message-ID: <3ae49cc3$1_1@dnews>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3ae3d70e_2@dnews> <3ae3de4a$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,3b1cfaee1687958
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-04-23 14:48:07 PST
From: "Harry Whitehouse" <harry@envmgr.com>
Newsgroups: borland.public.jbuilder.java.api
References:  <3ae3d70e_2@dnews>  <3ae3de4a$1_1@dnews>
Subject: Re: Combo Box ItemStateChange -- Seems to Fire 2X Per Change!
Date: Mon, 23 Apr 2001 14:21:15 -0700
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 38.168.115.135
Message-ID: <3ae49cc3$1_1@dnews>
X-Trace: dnews 988060867 38.168.115.135 (23 Apr 2001 14:21:07 -0700)
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews