Hi,
I added components to a JPanel, then added the JPanel to the
JScrolledPane, but the JScrolledPane won't scroll. Only arrows appear
on the side of the JPanel. Anyone know what I'm doing wrong?
Thank you,
Gil
SPG - 27 May 2005 09:28 GMT
> Hi,
>
[quoted text clipped - 5 lines]
>
> Gil
Hi,
What kind of layout manager are you using for your JPanel?
I'd check that first.. Then post a quick example
Steve
Fahd Shariff - 27 May 2005 15:25 GMT
You need to tell the jscrollpane how big your jpanel is by using the
get/setPreferredSize methods in your jpanel.

Signature
Fahd Shariff
Nigel Wade - 27 May 2005 16:17 GMT
> Hi,
>
[quoted text clipped - 5 lines]
>
> Gil
ScrollPanes work quite differently from other containers. The part of the
ScrollPane which is controlled by the scrolling action is the viewport. You
need to use JScrollPane.setViewportView() to "add" a component to the
scrollpane's viewport.

Signature
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555