# :: Reference :: Alignments :: Column alignments are: left, center, right, fill. And row alignments are: top, center, bottom, fill. The fill alignment expands a component to span its display area, so that the component's left-hand side is left-aligned, and the right-hand side is right-aligned. The same applies to top/bottom for rows. ## Applying Defaults FormLayout aims to minimize the effort to specificy alignments. Therefore it 1) tries to reuse alignments, 2) provide good defaults for form oriented layouts. 1) The column and row alignments are applied to all components that are located in a single cell of that column/row. A component can override its column/row alignment by setting an individual alignment via a CellConstraints object. 2) By default, the column alignment is set to fill. The implicit alignment for rows is center. And so, if you don't specify column and row alignments, your components will be horizontally filled and vertically centered. This is a good default for most text fields, combo boxes, buttons and it works fine with labels too. ## Alignment Constants The classes `ColumnSpec`, `RowSpec` provide constant values for the alignment values mentioned above. ## String Representations I recommend to specify column and row alignments in the FormLayout constructor using string representations. These strings will be accepted by the `FormLayout`, `ColumnSpec`, `RowSpec` and `CellConstraints` classes and by many builder methods.
    columnAlignment ::= LEFT | CENTER | RIGHT  | FILL | L | C | R | F
    rowAlignment    ::= TOP  | CENTER | BOTTOM | FILL | T | C | B | F
## Examples
    ColumnSpec.LEFT;
    ColumnSpec.FILL;
    new ColumnSpec("left");
    new ColumnSpec("f");

    RowSpec.BOTTOM;
    RowSpec.CENTER;
    new RowSpec("bottom");
    new RowSpec("c");

    new FormLayout("left:pref, 4dlu,    fill:pref",
                   " top:pref, 3dlu, center:pref");

    new CellConstraints(2, 3, ColumnSpec.LEFT, RowSpec.TOP);
    new CellConstraints(2, 3, "left, top");
    new CellConstraints(2, 3, "l, t");

    CellConstraints cc = new CellConstraints();
    builder.add(component, cc.xy(2, 3, "left, top");
(c) 2009 JGoodies |  |