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 1

public JComponent buildContent() {
    return new FormBuilder()
        .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(authorField).xy(3, 3)
        .add("_Price:")  .xy(1, 5)
        .add(priceField) .xy(3, 5)
        .build();
}

Example 2

public JComponent buildContent() { 
    return new ListViewBuilder() 
        .padding(Paddings.EPX24)
        .labelText("_Contacts:")
        .listView(contactsTable)
        .listBar(newButton, editButton, deleteButton)
        .detailsView(contactDetailsView)
        .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.