🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JList with scrollbar

#13258
From: Peter J Scott
Date: Wed, 26 Aug 1998 00:00
36 lines
1802 bytes
Yuo could also try

        JList list = new JList(model);
        JScrollPane scroll = new JScrollPane();
        scroll.getViewport().add(list);

In article <35E3EB20.E51998A5@ddsynergy.de>, Martin Anders
<m_anders@ddsynergy.de> writes
>Hi Alex,
....
>First try to add the elements before you set the viewport and see how that
>works.
>Maybe you have to call a repaint event, I am still looking for a solution for my
>application, I'll inform you once I've found one.
>
>Martin
>
>
>zimmerer wrote:
>
>> It does not work there still is no scrollbar. I've wrote a little
test code,
>> perhaps someone can take a short look at it and tell me whats wrong.
>>
.....>   JList list = new JList(model);
>>       JScrollPane scroll = new JScrollPane();
>>       scroll.getViewport().setView(list);
>>       //this doesn't work, too
>>       //JList list =new JList(model);
>>       //JScrollPane scroll = new JScrollPane(list);
>>       this.getContentPane().add(list);
>>       for (int i=0;i<20;i++) {
>>         model.addElement("item"+i);
>
-- 
Peter J Scott
Technical Details
Message-ID: <7UpnUBAQVF51EwTr@framland.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35E2A7B4.B5EC3479@cimag.de> <35E2F53B.2269C0AA@csi.com> <35E3D07E.FA559753@cimag.de> <35E3EB20.E51998A5@ddsynergy.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,b5ee876fbd119f83
X-Google-Attributes: gid111d45,public
From: Peter J Scott <peter@framland.demon.co.uk>
Subject: Re: JList with scrollbar
Date: 1998/08/26
Message-ID: <7UpnUBAQVF51EwTr@framland.demon.co.uk>
X-Deja-AN: 385005308
X-NNTP-Posting-Host: framland.demon.co.uk:194.222.31.244
References: <35E2A7B4.B5EC3479@cimag.de> <35E2F53B.2269C0AA@csi.com> <35E3D07E.FA559753@cimag.de> <35E3EB20.E51998A5@ddsynergy.de>
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 904156919 nnrp-08:9760 NO-IDENT framland.demon.co.uk:194.222.31.244
Organization: naught
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing