Re: suitable layout manager?

From: Karsten Lentzsch (Karsten_at_JGoodies.com)
Date: 05/09/04

  • Next message: Filip Larsen: "Re: add keybindings to a JList ?"
    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


  • Next message: Filip Larsen: "Re: add keybindings to a JList ?"

    Relevant Pages

    • Re: Programming Dilemma
      ... Since you mention Visio, I'll point out that one option is Visio itself ... Our MetaDraw control is another component you might consider. ... g) Scroll or zoom the entire layout ... > My boss wants me to design a fairy basic Electronic Digital ...
      (comp.programming)
    • Re: How competent are we?
      ... Changes in file layout are easy if IO is isolated in called programs. ... FOR EACH BRANCH in an array. ... That wouldn't happen if data structures had been designed in normalized form from the ... design should be top down. ...
      (comp.lang.cobol)
    • Re: Improving Word 2007
      ... <to move the Borders button from Design to Layout. ... Table Design to Table Layout? ... then recreate a custom group that contains the commands you want to show. ...
      (microsoft.public.word.docmanagement)
    • Re: Basics of Forma Layout
      ... menu on the left created with PanelSet? ... > of your overall design. ... > Another thing that gives you a fluid layout easily is HTML Framesets. ... > frame is a separate ASPX page. ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: Newbie Question : Board level design
      ... Do you have any actual layout tools in mind? ... requirements of the board are clear, the electrical design requirements ... App notes live in a perfect, ... other chips onboard, what is the first thing you go searching for? ...
      (sci.electronics.basics)