Sanity Check Requested For JScrollPane use

From: Fritz Foetzl (fritz_foetzl_at_hotmail.com)
Date: 10/27/04

  • Next message: Paul Lutus: "Re: Sanity Check Requested For JScrollPane use"
    Date: 26 Oct 2004 18:10:22 -0700
    
    

    I extended JPanel into something called a DrawingSurface that is used
    to render images. I set up a JScrollPane with a DrawingSurface
    instance as its client. When the drawing surface loads an image, it
    changes its size by calling setSize(). To my chagrin, my JScrollPane
    never worked right - the scrollbars never appeared at all.

    This changed once I started setting my DrawingSurface's preferred size
    in addition to its actual size. Suddenly, the scroll pane started
    doing what I needed it to do.

    Is setting a preferred size on a scroll pane's client a requirement
    for it to work correctly? It seems like it from my chair, but I find
    it odd that this doesn't seem to be mentioned in any of the tutorials.
    I even googled the living daylights out of this problem, and still had
    to noodle it out on my own.

    ff


  • Next message: Paul Lutus: "Re: Sanity Check Requested For JScrollPane use"