🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JList with scrollbar

#13263
From: Vladimir Olenin
Date: Thu, 27 Aug 1998 00:00
100 lines
3793 bytes
This is a multi-part message in MIME format.
--------------9D8B34A00E2510E0CF729366
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit

Hi, Alex,

Actually, Martin gave u really good advice. Most of swing components do
not update their contents automatically. So, try do the following:
invalidate(), validate(), repaint(). But almost for sure u should call
some of firexxx() functions to let JList know it'd be repainted. This
works with JTable.

                                   Vladimir

Martin Anders wrote:
> 
> Hi Alex,
> 
> ok I see, I've got the same problem with the jlist. It has maybe something to do
> with the graphic update of the jList.
> I have two jLists on two jPanels with a cardlayout. When I add elements to one
> list I see no scrollbar. After I've changed between the two panels (put the
> first panel behind the second one and then bring it back to front) suddenly the
> jlist has a scrollbar.
> 
> 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.
> >
> > import com.sun.java.swing.*;
> > import java.awt.*;
> > import java.awt.event.*;
> >
> > public class Test extends JFrame {
> >
> >   public Test() {
> >     Frame1 frame = new Frame1();
> >     frame.setVisible(true);
> >   }
> >   public static void main(String[] args) {
> >     new Test();
> >   }
> >
> >   class Frame1 extends JFrame {
> >     GridLayout grid = new GridLayout();
> >     public Frame1() {
> >       this.getContentPane().setLayout(grid);
> >       this.setSize(200,200);
> >       DefaultListModel model = new DefaultListModel();
> >       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);
> >       }
> >     }
> >     protected void processWindowEvent(WindowEvent e) {
> >       super.processWindowEvent(e);
> >       if (e.getID() == WindowEvent.WINDOW_CLOSING) {
> >         System.exit(0);
> >       }
> >     }
> >   }
> > }
> >
--------------9D8B34A00E2510E0CF729366
Content-Type: text/x-vcard; charset=koi8-r;
 name="acidsteve.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Vladimir Olenin
Content-Disposition: attachment;
 filename="acidsteve.vcf"

begin:vcard
n:Olenin;Vladimir
x-mozilla-html:FALSE
org:
adr:
version:2.1
email;internet:acidsteve@hempseed.com
title:Card
note:Java programmer. Open for projects development offers.
fn:Vladimir Olenin
end:vcard


--------------9D8B34A00E2510E0CF729366--
Technical Details
Message-ID: <35E4906C.71069691@hempseed.com>
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: Vladimir Olenin <acidsteve@hempseed.com>
Subject: Re: JList with scrollbar
Date: 1998/08/27
Message-ID: <35E4906C.71069691@hempseed.com>
X-Deja-AN: 385077276
References: <35E2A7B4.B5EC3479@cimag.de> <35E2F53B.2269C0AA@csi.com> <35E3D07E.FA559753@cimag.de> <35E3EB20.E51998A5@ddsynergy.de>
X-Accept-Language: ru
Content-Type: multipart/mixed; boundary="------------9D8B34A00E2510E0CF729366"
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing