Article View: borland.public.jbuilder.java.swing
Article #10638Re: JComboBox - setSelectedItem doesn't work
From: Raf Lenaerts
Date: Tue, 24 Aug 1999 00:00
Date: Tue, 24 Aug 1999 00:00
25 lines
1084 bytes
1084 bytes
>I have a simple JComboBox, that I add items to:
>
> jComboBox1.addItem("100.123.456.789");
> jComboBox1.addItem("100.123.456.790");
> jComboBox1.addItem("100.123.456.791");
>
>If, when I present this ComboBox to the user, I
>want to have item # 2 already selected, then I try:
>
> jComboBox1.setSelectedItem("100.123.456.790");
I always use :
jComboBox1.setSelectedIndex(1);
to select item #2. That works fine for me
>
>But when it comes up, it always has item #1
>selected.
>
>Any hints, suggestions? Thanks!
>
> -- Robert
>
Technical Details
Message-ID:
<7prdj3$j6$1@news3.Belgium.EU.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01beeb0e$8bc0f220$238eabc6@rtlaird>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,699b2bb1d7db8f99 X-Google-Attributes: gid111d45,public From: "Raf Lenaerts" <raf.lenaerts@student.luc.ac.be> Subject: Re: JComboBox - setSelectedItem doesn't work Date: 1999/08/24 Message-ID: <7prdj3$j6$1@news3.Belgium.EU.net> X-Deja-AN: 516138730 References: <01beeb0e$8bc0f220$238eabc6@rtlaird> Organization: EUnet Belgium, Leuven, Belgium X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.swing