The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by manis]

I have JList containing checkBox items (using renderer) and have added the
JList to a JScroll pane (aScrollPane.getViewport().add(myList).
When I display this from within a JPanel in a JApplet..I see elements painted
outside the scrollpane....BUT when I run it standalone from a JFrame for
testing..I do not have this painting problem.
I am using 1.1.6 and 1.02 swing from within Visual Age.
Thanks for your help.
import-bot (20211) [Avatar] Offline
#2
Re: JList items displaying outside the JScrollPane
[Originally posted by wwake]

Have you tried putting the list in the constructor of the JScrollPane?
(That's how I've normally done it.)

Something like:
JList list = ...
JScrollPane scroller = new JScrollPane(list);

Regards,
Bill Wake
import-bot (20211) [Avatar] Offline
#3
Re: JList items displaying outside the JScrollPane
[Originally posted by matt]

I second Bill's solution.

Do not use JViewport's add() method. Instead you should be using setView().
This will do the same thing as passing the list directly to the JScrollPane
constructor.
import-bot (20211) [Avatar] Offline
#4
Re: JList items displaying outside the JScrollPane
[Originally posted by manis]

> I second Bill's solution.
>
> Do not use JViewport's add() method. Instead you should be using setView().
> This will do the same thing as passing the list directly to the JScrollPane
> constructor.
Hi Bill/Matt..Thanks. setView worked for me. I also used Matts answer from
an older page on JList to look at the layout of the underlying JPanel to which
the scollPane was added. Together I solved my problem.
Thanks Matt and Pavel for a great book on Swing. I started with "Up to speed"
and
now with "Swing" I have a great pair for my work.