July 13, 2004Why GridBagLayout must dieIf you have ever tried to understand how the GridBagLayout works, I am sure this will strike a chord. Posted by cedric at July 13, 2004 06:14 AM Comments
This is so funny, I use gridbag every week and I still can't put my widgets at the right place on the first try.... Posted by: Simon at July 13, 2004 06:55 AMReally great! And worst of all... there existed better layout mechanisms ages before (think NeXTStep). Posted by: Heiko at July 13, 2004 07:08 AMBasically the layout manager in NeXTStep, now used in Interface Builder on Mac OS X, is Springs-n-Struts except that it is much easier to use because every spring and strut isn't an object and are directly on the components. Additionally, you almost never use it programmatically, only in the building tool. Posted by: Sam Pullara at July 13, 2004 01:20 PMI have switched to using forms from jgoodies for 99% of my layout needs. It has been open sourced by SUN, and is a joy to use. It's the best layout since SlicedBreadLayout. No Swing/SWT programmer should be without it. Posted by: Zohar at July 13, 2004 03:31 PMTrial & Error, that's what I can remember from the GridBagLayout. But GridBagLayout anyday over a null layout or a FlowLayout ;-). If Sun only fixed this annoying BUG, I would happily use GridBagLayout happy after: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4238932 Only one example why Swing (AWT) is screwed up for no reason. Posted by: svenmeier at July 14, 2004 02:10 AMToo funny ! Thank for the link :) Posted by: patrick at July 15, 2004 12:51 PMI actually wrote a little prog to generate gridbaglayout more interactively. It is on It is not intuitive to work with GridBagLayout but powerful enough for all your needs, that is why I would not spit on it as much as you guys. JGoodies is nice but is much more than just a Layout. Posted by: qwerty at July 16, 2004 02:33 AMI love gridBagLayout! once you get the hang of it you can quickly layout things exactly where you want them. this is as complex as my layouts can get it may look a bit intimmidating at first but it's quick to write and easy to maintain - setLayout(new GridBagLayout()); add(new JLabel("String before leading token:"), new GridBagConstraints(COL_LBL,1,1,1,0,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE, new Insets(VERTICAL_LINE_SPACING,0,0,0), 0,0)); add(getTxtStringBeforeToken(), new GridBagConstraints(COL_TXT,1,1,1,1,0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE, new Insets(VERTICAL_LINE_SPACING,0,0,0), 70,0)); we're actually moving to swt hell right now and i can't find a normal layout.. swt gridBag really sucks Posted by: plasticfloor at March 13, 2007 04:33 AMPost a comment
|