πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.gui
Article #125

Re: TOO SLOW list.add(element) OR choice.add(element)

#125
From: Kendall Helmstetter Gelner
Date: Mon, 01 Feb 1999 00:00
20 lines
1729 bytes
Luis Miguel Crespo PοΏ½rez <lmc@sdsoftware.es> wrote:

>I find to slow adding strings to lists and choices, if I try:
>    for (int i = 0; i < 1000; i++)
>        list.add("Element " + i);
>this takes for ever, and even worse, the list starts scrolling up
>and down while adding elements.
>
>This also happens to Choice components.
>
>Is there a way to avoid it ?
>
>If so, please send an ansawer to:
>    lmc@sdsoftware.es

You should make a ListModel (there should be a DefaultListModel you can
subclass from to make the coding easier), put all of the strings you want
in it, then attach the ListModel to a List with the setModel() call.  It's
all in repaint, or listeners, or any of the other things the others have
pointed out.
Technical Details
Message-ID: <36ba4bcf.129830334@news.newsguy.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36B091E6.C92DC76F@sdsoftware.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10fd6d,eac07156a46eb363
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: 115d3b,eac07156a46eb363
X-Google-Attributes: gid115d3b,public
X-Google-Thread: 1116f3,eac07156a46eb363
X-Google-Attributes: gid1116f3,public
X-Google-Thread: 10a146,eac07156a46eb363
X-Google-Attributes: gid10a146,public
X-Google-Thread: 113ae9,eac07156a46eb363
X-Google-Attributes: gid113ae9,public
From: kgelner.bork@bork.bigfoot.bork.com (Kendall Helmstetter Gelner)
Subject: Re: TOO SLOW list.add(element) OR choice.add(element)
Date: 1999/02/01
Message-ID: <36ba4bcf.129830334@news.newsguy.com>
X-Deja-AN: 439281231
Content-Transfer-Encoding: 8bit
References: <36B091E6.C92DC76F@sdsoftware.es>
Content-Type: text/plain; charset=ISO-8859-1
Organization: http://extra.newsguy.com
Mime-Version: 1.0
Newsgroups: comp.lang.java.gui,es.comp.lenguajes.java,comp.lang.java.programmer,comp.lang.java.security,comp.lang.java.help