Results 1 to 3 of 3

Thread: JScrollPane problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    2

    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.

  2. #2
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    2
    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
  •  



Click Here to Expand Forum to Full Width