StretchableLayoutManager question


I’m playing with the StretchableLayoutManager, and what I’d like is to be able to split my window horizontally, and show two different areas of the same component simultaneously, as XCode’s editor windows do.

I figured I could do this by putting two Viewports in my StretchableLayoutManager and then putting the same component in each viewport using Viewport::setViewedComponent().

When I do this, however, I end up with the component showing in only the bottom Viewport, and with the scrollbars of the two Viewports linked together in lockstep, so it’s impossible to scroll one to a different area than the other. If I put two different components in the Viewports, all is well, but I’d like for changes in one to show in the other, so I would really like for there to be only one instance of the viewed content.

What am I missing here? There must be a way to use two Viewports to show two different sections of the same component.