I have a container that has within it some unknown number of components (which are actually also containers in which I have overridden calcPreferredSize to make them a consistent size). Since the number of components may be > the number that can fit on a single line, there may be an overflow to line 2, etc.
I am using FlowLayout on the outer container, which works fine for one row. But the second row is offset.
So where I want:
|.X.X.X.|
|.X.X.X.|
I actually get:
|.X.X.X.|
|X.X.X..|
where X is the component, dots are spacing, and | are the sides of the container.
What is the best way to do this? I assume FlowLayout does this because the left margin for the first element on row 2 is actually applied on the top row, so there is no margin remaining to push it away from the container border.
I have tried GridLayout, but I find the rightmost X component on each row is expanded beyond the preferred size I have set.