🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10194

Re: Please Help ME...(Problem about JList & JCombobox)

#10194
From: John Frazier (Borland)
Date: Fri, 05 Nov 1999 00:00
55 lines
2476 bytes
On Fri, 05 Nov 1999 20:57:36 +0800, ERic <eric.yu@usa.net> wrote:

><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
><html>
>The Problem was solved! Thanks SO SO SO SO MUCH!!!&nbsp;&nbsp; ^__________^
><p>ERic
><br>&nbsp;
><p>Gerry Stechow wrote:
><blockquote TYPE=CITE>hi eric,
><p>swing implements an model-view-controller concept.
><br>this means, that the data aren't direct stored in the jList (view),
><br>but it's stored in an underlying ListModel (model). if you don't specified
><br>one, swing uses the DefaultListModel.
><p>how to add an entry:
><p>jList1.getModel().add(Object element);
><br>or
><br>jList1.getModel().add(int index, Object element);
><p>the add-methode fires an event and the view will be updated.
><p>cu gerry
><p>ERic wrote:
><br>>
><br>> My problem is:
><br>>
><br>> When in AWT, I can use "list.add()" or "list.addItem()" to add data
><br>> items to my list ONE by ONE,
><br>> buy, within Swing, I can't find the method that allow me to add data
><br>> item one by one tomy JList or
><br>> JCombobox???
><br>>
><br>> ...
><br>> JList jList1 = new JList();
><br>> ..
><br>>
><br>> for (i = 0; i &lt; Student_Name.length; i++) {
><br>>&nbsp;&nbsp;&nbsp;&nbsp; jList1.add( Student_Name[i]);
><br>>&nbsp;&nbsp;&nbsp; ^^^^^^^^^^^^^
><br>> }
><br>> ....
><br>>
><br>> Because the content of&nbsp; Student_Name[] is not fixed, so I can't
>use "
><br>> new JList(Student_Name[])" to
><br>> do this,&nbsp; I have to add the data item one by one.....
><br>>
><br>> PLEASE HELP ME............. THANKS SO MUCH!!!
><br>>
><br>> ERic</blockquote>
></html>

Please refrain from posting in HTML and stick with straight ASC.  Many
people her use newsreaders that don't support HTML.

John Frazier (Borland)

http://www.borland.com/devsupport/disclaim.html
Technical Details
Message-ID: <3824007a.2941038@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3822B46C.BCC06F27@usa.net> <3822D49E.5645F476@isys-group.de> <3822D440.2DBA109D@usa.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,5598d06099a399b3
X-Google-Attributes: gid111d45,public
From: supportinfo@borland.com (John Frazier (Borland))
Subject: Re: Please Help ME...(Problem about JList & JCombobox)
Date: 1999/11/05
Message-ID: <3824007a.2941038@forums.inprise.com>
X-Deja-AN: 544894066
Content-Transfer-Encoding: 7bit
References: <3822B46C.BCC06F27@usa.net> <3822D49E.5645F476@isys-group.de> <3822D440.2DBA109D@usa.net>
Organization: Another Netscape Collabra Server User
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing