|
-
Feb 29th, 2004, 09:28 AM
#1
Thread Starter
New Member
JScrollPane problem
I am adding a JPanel to a JScrollPane. Within the panel, I am running graphics that sometimes go off the screen. I cannot get the scrollbars to work when the graphics are off the screen. I've tried to revalidate and repaint, but that doesn't help.
I appreciate any help anyone can give me.
Thanks.
-
Mar 9th, 2004, 04:25 AM
#2
Addicted Member
Painting
Have you tried, setBound() setSize() on the Panel within the JScrollPane?
From what i've been doing i've had a lot of problems with JPanels inside of JScrollPanes, as they insist on setting there size to the size of the viewport on the JScrollPane, one solution i had was that in my paint Method i set the preffered size of the JPanel so it is always painting to a canvas the correct size, and the Scrollpanes actually work and allow you to move around te JPanel..
IS that what you meant? i'm actually wokring on something that i think is what your doing so let me know if i've understood what you meant!
Andy
-
Mar 9th, 2004, 10:43 PM
#3
Thread Starter
New Member
Thanks for the reply.
I got my code working by finding the updated dimensions of the screen and sending that value to the setPreferredSize method.
Works like I want it too now.
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|