JScrollPane and JViewport
1 posts in topic
Flat View  Flat View

Posted By:   hakan_geri
Posted On:   Monday, September 3, 2001 04:01 PM

Hi, i have a problem with setting size JScrollPane. I want to add a panel to scrollpane and i'm trying to set it's size, like below :

JViewport vp = new JViewport();

vp.setView( pScp );

vp.setViewSize( new Dimension( 400, 400 ) );

JScrollPane scp = new JScrollPane();

scp.setViewport( vp );

add( scp );

But this code does not have any effect and the panel is displayed in it's actual size.

Any comments are welcomed. Thanks in advance.

Re: JScrollPane and JViewport

Posted By:   J_R  
Posted On:   Tuesday, September 4, 2001 02:27 AM

well add scp to your scrollpane first

then setViewPort
and then
add srollpane
add( scp );
if this does not work then
setLayout of your mainpanel null
in this way

then add the scroll pane
and then write
scp.setBounds(x, y, width, height);
About | Sitemap | Contact