JGoodies FormLayout

The FormLayout helps you lay out and implement consistent Swing panels fast. FormLayout makes simple things easy and the hard stuff possible.

  • Powerful, flexible, previse layout
  • Easy to learn and easy to work with
  • Faster panel production
  • Better code readability

The free JGoodies Forms library consists of the FormLayout, builder, and factories that further reduce the effort required to implement standardized layouts. FormLayout supports resolution independent screen design. The layout can honor the screen resolution and font size to retain the layout proportions in different environments.

Download the latest version

Download the Showcase application to get tutorial sources.

Unique Meta Design Support

The JGoodies FormLayout is the leader in design consistency and meta design support. Where other Java layout managers just lay out individual forms, FormLayout supports consistency across multipe layouts. Using layout variables you can implement a visual design concept for families of associated forms.

Stable API, Rock-Solid Code

Since version 1.0 – back in 2001 – the FormLayout uses the same API and there were no bugs in the layout implementation. This has been achieved by factoring out all non-layout features to separate classes that have been carefully changed from time to time.

Example

public JComponent buildContent() {
    return FormBuilder.create()
        .columns("$label, ${label-component-gap}, [100dlu, pref]")
        .rows("p, $lg, p, $lg, p")

        .add("&Title:")  .xy(1, 1)
        .add(titleField) .xy(3, 1)
        .add("&Author:") .xy(1, 3)
        .add(auhtorField).xy(3, 3)
        .add("&Price:")  .xy(1, 5)
        .add(priceField) .xy(3, 5)
        .build();
}

Acknowledgements

The form-oriented building has been inspired by the grid layout system as described by Kevin Mullet and Darrel Sano in their book Designing Visual Interfaces. The FormLayout’s API has roots in the APIs of TableLayout by Daniel Barbalace, HIGLayout by Daniel Michalik and GridBagLayout by Doug Stein. The concept of dialog units has been taken from Microsoft user interface implementations.