GridBagLayout problems (original) (raw)

Hi. I'm trying to lay out a series of components (panels, in this case, but that probably shouldn't matter) in a horizontal row.

I'm currently using GridBagLayout for this. Let me know if I should be using something else.

How do I tell GridBagLayout (or whatever other Layout Manager) to leave space between the components rather than sticking them right onto each other?

Specifically, I want it to space them out evenly across the width of the parent container. So if there are, say, 10 of them, each with width 50, and the container has width 590, then there should be 10 pixels of space between them. If the parent container had width 500, they should be stuck onto each other.

Thanks in advance...