-
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.
-
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
-
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.