Our Old Friend: GridBagLayout
September 28th, 2006
I stumbled across this article about my old friend the GridBagLayout today. I for one thought I was in a very small minority when it comes to actually using and liking the GridBagLayout. Well, Jeff Friesen proved that he is also on my side when he wrote Harness the Power of Java's GridBagLayout. The article is a very good demystifier for those non-believers out there.
Since this is the first article in a series, it really only covers the basics, but it promises even more. Jeff does say that in case you're still not impressed with GridBagLayout, part 3 presents the JGoodies FormLayout alternative, and compares this layout manager with GridBagLayout so you can choose the layout manager that works best for you.
I can't wait. People are always telling me to switch to FormLayout, but I've used it in the past and have not looked back. I just did not like dealing with those cryptic configuration strings ("3dlu p d:fill 4f 5u") all the time. I look forward to the 3rd part of the series.
If your scratching your head over which LayoutManager to use for forms, I would recommend the GridBagLayout. Our old friend.
Right on.
For many years now, whenever I try to do non-trivial layout with some other manager, I always end up investing hours with nested panels to do what GridBag can do without tricks.