[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] ScrollPane behavior and API: trying to understand
|
In the process of writing some simple examples, I found a confusing behavior
that I want to ask the group about.
Here's what I did:
1) I made a ScrollPane that contains a child Figure, imageLayer.
2) To the imageLayer Figure I gave this Figure an XYLayout as its
LayoutManager and I added 50 ImageFigures as its children.
3) For each of the ImageFigures, I called setBounds(x,y,w,h) to set its
position and bounds, and then called imageLayer.add(imageFigure) to assign
each ImageFigure its parent.
4) I called scrollpane.setContents(imageLayer) to set it up.
When I did this, I got all this stuff on the screen, but the scroll bars of
the ScrollPane don't show up. I thought this was weird.
I tried calling revalidate() on the ScrollPane after adding all the
ImageFigures to the imageLayer parent figure, but that didn't make the
scrollbars appear either.
I poked around in it for a while longer and hit upon a subtle change in the
implementation after reading some example code.
The change I made was to step 3 (the change to which I will now call step
3').
3') For each of the ImageFigure, call imageLayer.add(imageFigure, bounds) to
assign each figure its parent and set its bounds and position.
Now the scroll bars are showing up. But why? My initial implementation was
based on just looking at the API and trying to use it the way that it seemed
to make sense to me, yet it didn't give me the results I wanted...I would be
very interested to hear your thoughts on the matter.
Thanks,
Mark