Another Java Question -- How to get same sized 'columns' w/ GridBagLayout -- or any other

statik213

Golden Member
Oct 31, 2004
1,654
0
0
How can I have a bunch of Components aligned in 4 columns so that the column 1 and 3 are the same width and column 2 and 4 are the same width? GridBag good for this?

 

znaps

Senior member
Jan 15, 2004
414
0
0
GridBagLayout is probably your best option in the JDK (Not sure about what other behaviour you need, but if you set items in column 1 and 3 to have the same weight x, and items in column 2 and 4 with the same weightx should do the job).

I've been using a free 3rd party LayoutManager called FormLayout from http://www.jgoodies.com which is way nicer to use and provides exactly what you want also.