Re: suitable layout manager?
From: Karsten Lentzsch (Karsten_at_JGoodies.com)
Date: 05/09/04
- Previous message: Roedy Green: "Re: suitable layout manager?"
- In reply to: George: "Re: suitable layout manager?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 09 May 2004 11:37:51 +0200
George wrote:
> Use the GridBagLayout all the time. it's the most flexible - anything
> else is a waste of time.
GridBagLayout is one of the weaker layout managers.
You can hardly design well with the GridBagLayout.
From the GridBagLayout's complexity it doesn't follow
that it can implement complex or even simple layout.
Here's a presentation that summarizes a bunch of
design and layout essentials you *can't* do with GBL
http://www.jgoodies.com/articles/layout-essentials.pdf
And this demo presents several layout tasks you
*cannot* implement with the GridBagLayout
- although most of them seem to be very easy:
http://www.jgoodies.com/freeware/formsdemo/
You can find more information about problems
beginners and experts face with the GridBagLayout
http://www.jgoodies.com/articles/layout.pdf
http://www.jgoodies.com/articles/forms.pdf
Besides the GridBagLayout's poor layout capabilities
many developers cannot work efficiently with it
- even if they have mastered to understand the concept.
One of the problems is, that it is difficult to build
a mental layout from GBL layout sources, because the
layout grid depends on the component constraints.
If you have 50 components, you can build a mental layout
only if you perform 50 state transitions in your head.
You have to read the complete layout instruction,
because the last component can change the layout grid.
TableLayout, HIGLayout and FormLayout address this
issue by defining the layout grid statically.
Btw. the most flexible layout manager is SpringLayout
that has been designed in a way that you can extend
the layout algorithm itself by providing custom springs.
But SpringLayout seems to be hard to use too.
Alex Prayle's ExplicitLayout and my FormLayout are
powerful and flexible layout managers that cover
almost all everyday design tasks for form oriented design.
Most layout managers cannot implement design that
follows the Microsoft layout style guides. This guide
defines layout in dialog units that scale with the
font and resolution (not screen size). And that's
more and more important, because todays resolutions
vary between 86dpi and 147dpi. If you use pixel sizes
for minimum widths, gaps, borders, etc you don't
retain proportions! The JGoodies Forms Demo demonstrates
this problem and how to address it. GBL, TableLayout,
HIGLayout, SpringLayout and even ExplicitLayout
do not master this problem.
FormLayout supports non-pixel sizes, logical sizes
and the additional Forms helper classes can honor
a platform style guide.
... Enough said :) See the whitepaper and presentations.
Anyway, the original poster's layout problem can be
implemented with the GridBagLayout, with two nested
GridLayouts, BoxLayouts, with SpringLayout, TableLayout,
HIGLayout and ExplicitLayout. But none of these layouts
would retain proportions if the font or resolution changes.
Likely none of these layouts would match the MS layout
guide *and* the Mac Aqua Human Interface Guide at the
same time.
Hope this helps. Regards,
Karsten
- Previous message: Roedy Green: "Re: suitable layout manager?"
- In reply to: George: "Re: suitable layout manager?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|