Article View: borland.public.jbuilder.java.swing
Article #12860JComboBox addItem poor performance
From: Nigel Fletton
Date: Tue, 27 Oct 1998 00:00
Date: Tue, 27 Oct 1998 00:00
20 lines
1081 bytes
1081 bytes
Any ideas on why the addItem call in the example code below is very slow
when rebuilding the content of a JComboBox?
The vector typically contains around 50 Strings. On the application this
code sample comes from, there are several similar combo boxes on a
tabbed form that result in the form being very slow to rebuild when new
data is loaded.
Vector v;
.......
String strExample;
combo.removeAllItems();
e = v.elements();
while(e.hasMoreElements()) {
strExample = e.nextElement().toString();
combo.addItem(strCompItem);
}
Nigel
Technical Details
Message-ID:
<3635DEFB.9C533C93@bt.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: 111d45,f8cf4a252f41cfb9,start X-Google-Attributes: gid111d45,public From: Nigel Fletton <nigel.fletton@bt.com> Subject: JComboBox addItem poor performance Date: 1998/10/27 Message-ID: <3635DEFB.9C533C93@bt.com> X-Deja-AN: 405573264 Content-Transfer-Encoding: 7bit Organization: British Telecommunications plc Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing