#12 Resizeable BScrollPane doesn't resize properly

open
nobody
None
5
2004-11-18
2004-11-18
Avi Drissman
No

This is a problem we're seeing on the PC, not the Mac. If you have a
BScrollPane in a resizeable container (e.g. BorderContainer),
resizing the scroll pane causes the scrollbars to be sized incorrectly.
They are placed against the right and bottom, but are as long as the
_previous_ size of the scroll pane, not the current size.

To reproduce, run the attached xml file through a WidgetDecoder.
You'll get a window. Resize it and watch the scrollbars.

I'm working on figuring out what's going on. There are two things of
note that I found.

First is that the scroll pane is being laid out _twice_. The first time
is from JPanel's Container.validateTree() and the second time is
from BFrame's WindowWidget.layoutChildren().

Secondly, there seems to be some kind of race condition as I'm
getting different results when running it under the debugger.

Attached are two files: the view xml, and the stack crawls. I'm still
investigating and will post further info here.

Discussion

  • Avi Drissman
    Avi Drissman
    2004-11-18

    The view xml

     
  • Peter Eastman
    Peter Eastman
    2004-11-28

    Logged In: YES
    user_id=74743

    Perhaps this is specific to one Look and Feel? Try using Metal on both
    the PC and the Mac, and see if they behave the same.

    I have a Mac, so it will be hard for me to debug this if I can't reproduce
    it.

     
  • Peter Johnson
    Peter Johnson
    2005-02-08

    Logged In: YES
    user_id=848683

    I've been looking at this a bit and it looks like Buoy is actually resizing
    the scroll bars properly, but the scroll bars don't want to draw
    themselves in the new bounds until either the maximum, value, or
    extend (or possibly some combination) changes.

    I've got a temporary work-around for this that does 2 things:
    1. If the "viewport" is bigger than the content, then it sets the max,
    value, and extent to 0, which draws the scrollbar with no thumb.
    2. Always make sure that the max and value change in the above case,
    by actually setting them to 1, then setting them to 0.

    It sounds stupid, but its the only thing I've found that works. A better
    solution could probably be found by digging in to the swing source code,
    but I'm not that motivated at this time.

    A better solution on Windows might just be to use the "when needed"
    attribute for the scroll bars on Windows and "always" on the Mac.