FlowLayout wrapped components not showing when nested in a GridBagLayout
Hello, I'm having a problem when adding multiple components to a FlowLayout that is inside a grid of a GridBagLayout. I'd love to post some code, but it's really entrenched, so I'll try to give an a decent verbal example below.
The problem is that when I fill a grid in the GridBagLayout, it happily goes to the end of the JScrollPane it's nested inside (this is necessary for vertical movement, but horizontal is disabled). When I add a JPanel to this right-most grid, and set it FlowLayout, and then add any n components, the components plow right off the right side of the screen (and again, having a horizontal scroller is not acceptable to the users).
I've tried screwing around with setting the preferred size: if I set the preferred width to 0 (or to anything smaller than the width of the JScrollPane), the FlowLayout wraps the components (good) but doesn't take up the height it needs to display them (bad). They get stuck "under" whatever is painted next. If I set the preferred height to some arbitrary value, it will show them, but maintains that value even when the window is resized, so again some components get buried.
Further, the arbitrary size that I'm setting can't be calculated, as I can't get the preferred size (or any size) of the FlowLayout until after it's been drawn to the screen!
Is there something that I'm missing here, or some trick that I haven't stumbled across before to make this work the way that I want it to? (That being that a JPanel nested in some grid in a GridBagLayout, and having sufficient GridBagConstraints, and being set to FlowLayout, will display all the components dropped in it, wrapping them as they reach the end of the JScrollPane that encapsulates the GridBagLayout).
Any help is greatly appreciated!

