🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

JList size in a JScrollPane?

#12732
From: Dave Howorth
Date: Mon, 09 Nov 1998 00:00
32 lines
2000 bytes
Hi,

Can anybody explain how the size of a JList in a JScrollPane is managed, or
point me to an explanation of it?

I have a JList in a JScrollPane in a JPanel on a JDialog, and I have two
particular problems:

(1) When I make the dialog taller (as a user, dragging it at runtime), the
list [I assume] expands, adding white space after the end of the list. This
is fine. But when I then make the dialog box slightly shorter, a scroll bar
is added and I can scroll to a completely blank area. What should happen,
IMHO, is for the JList to remove the blank space and just become 'naturally'
shorter, still with no scroll bar. What am I missing?

(2) If I change the data being displayed in the listbox, using:
        jList.setModel(aDifferentModel);
the size of the list does not change. If my new list is twice as long as the
old one, the scrollbars are unchanged and won't let me scroll past the first
half of the list. If I put the focus on the list and use cursor-down, it
will let me scroll down the list but just displays grey nothingness!

These problems are symptomatic of my lack of understanding of the AWT/Swing
display paradigm. I've tried various random combinations of *.*validate()
and *.*paint(), with no success. Other questions that trouble me are things
like what happens if I want to do something special when a user resizes my
components?

Can anybody point me to an explanation of this stuff that is readable, and
(not necessarily in the same place) ultimately comprehensive/accurate?

Thanks, Dave
Technical Details
Message-ID: <727hon$ov14@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1177ab7a6295220d,start
X-Google-Attributes: gid111d45,public
From: "Dave Howorth" <5bx@iname.com>
Subject: JList size in a JScrollPane?
Date: 1998/11/09
Message-ID: <727hon$ov14@forums.borland.com>
X-Deja-AN: 410045977
Organization: Another Netscape Collabra Server User
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Newsgroups: borland.public.jbuilder.java.swing