Article View: borland.public.jbuilder.java.language
Article #8401populating JList
From: Alan Shiers
Date: Mon, 19 Mar 2001 15:01
Date: Mon, 19 Mar 2001 15:01
28 lines
1850 bytes
1850 bytes
Hi there,
I'm working on an applet and trying to understand the JList class.
So far I understand that you simply pass as array of strings to its
constructor in order to populate it, but that only seems to work once!
Here is a method I created for populating a JList:
String WordList[];
void populateListBox()
{
WordList = WDS.getNewWordList(10,6);
jList1.setListData(WordList);
}
WDS.getNewWordList(10,6) is a class method that returns a string array
of a list of randomly selected words derived from a Vector holding all
the words found in a dictionary.
When this is run the first time, it works fine. However, ever
subsequent call to this method doesn't result in the JList repopulating
with a new set of words. It just continues to display the first set of
words, and that's it.
What do I need to do to make the listbox do what I expect it to do? I
want it to repopulate with a new set of words everytime I call this
method!
Alan
Technical Details
Message-ID:
<3AB61F4E.B28E02B1@hfx.eastlink.ca>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews!24.222.107.5Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,739bbd1c6e02318,start X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-23 03:36:08 PST Message-ID: <3AB61F4E.B28E02B1@hfx.eastlink.ca> Date: Mon, 19 Mar 2001 10:01:34 -0500 From: Alan Shiers <jshiers@hfx.eastlink.ca> X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: populating JList Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.222.107.5 X-Trace: 19 Mar 2001 06:08:33 -0800, 24.222.107.5 Lines: 29 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!sunqbc.risq.qc.ca!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews!24.222.107.5