Class FormBuilder.ComponentAdder

java.lang.Object
com.jgoodies.forms.builder.FormBuilder.ComponentAdder
Direct Known Subclasses:
FormBuilder.NoOpComponentAdder
Enclosing class:
FormBuilder

public static class FormBuilder.ComponentAdder extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final FormBuilder
     
    private final Component
     
    private boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ComponentAdder(FormBuilder builder, Component component)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected FormBuilder
    add(CellConstraints constraints)
     
    at(CellConstraints constraints)
    Sets the given cell constraints.
     
    rc(int row, int col)
    Sets row and column origins; sets height and width to 1; uses the default alignments.
    rc(int row, int col, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
    Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.
    rc(int row, int col, String encodedAlignments)
    Sets row and column origins; sets height and width to 1; decodes vertical and horizontal alignments from the given string.
    rchw(int row, int col, int rowSpan, int colSpan)
    Sets the row, column, height, and width; uses default alignments.
    rchw(int row, int col, int rowSpan, int colSpan, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
    Sets the row, column, height, and width; sets the vertical and horizontal alignment using the specified alignment objects.
    rchw(int row, int col, int rowSpan, int colSpan, String encodedAlignments)
    Sets the row, column, height, and width; decodes the vertical and horizontal alignments from the given string.
    rcw(int row, int col, int colSpan)
    Sets the row, column, height, and width; uses a height (row span) of 1 and the vertical and horizontal default alignments.
    rcw(int row, int col, int colSpan, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
    Sets the row, column, height, and width; sets the vertical and horizontal alignment using the specified alignment objects.
    rcw(int row, int col, int colSpan, String encodedAlignments)
    Sets the row, column, height, and width; decodes the vertical and horizontal alignments from the given string.
    xy(int col, int row)
    Sets column and row origins; sets width and height to 1; uses the default alignments.
    xy(int col, int row, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
    Sets the column and row origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.
    xy(int col, int row, String encodedAlignments)
    Sets column and row origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.
    xyw(int col, int row, int colSpan)
    Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.
    xyw(int col, int row, int colSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
    Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects.
    xyw(int col, int row, int colSpan, String encodedAlignments)
    Sets the column, row, width, and height; decodes the horizontal and vertical alignments from the given string.
    xywh(int col, int row, int colSpan, int rowSpan)
    Sets the column, row, width, and height; uses default alignments.
    xywh(int col, int row, int colSpan, int rowSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
    Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects.
    xywh(int col, int row, int colSpan, int rowSpan, String encodedAlignments)
    Sets the column, row, width, and height; decodes the horizontal and vertical alignments from the given string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • builder

      protected final FormBuilder builder
    • component

      private final Component component
    • labelForSet

      private boolean labelForSet
  • Constructor Details

  • Method Details

    • labelFor

      public final FormBuilder.ComponentAdder labelFor(Component c)
    • at

      public final FormBuilder at(CellConstraints constraints)
      Sets the given cell constraints.

      Examples:

       .add(aComponent).at(cellConstraints)
       
      Parameters:
      constraints - specifies where an how to place a component
      Returns:
      a reference to the builder
    • xy

      public final FormBuilder xy(int col, int row)
      Sets column and row origins; sets width and height to 1; uses the default alignments.

      Examples:

       .add(aComponent).xy(1, 1)
       .add(aComponent).xy(1, 3)
       
      Parameters:
      col - the column index
      row - the row index
      Returns:
      a reference to the builder
    • xy

      public final FormBuilder xy(int col, int row, String encodedAlignments)
      Sets column and row origins; sets width and height to 1; decodes horizontal and vertical alignments from the given string.

      Examples:

       .add(aComponent).xy(1, 3, "left, bottom");
       .add(aComponent).xy(1, 3, "l, b");
       .add(aComponent).xy(1, 3, "center, fill");
       .add(aComponent).xy(1, 3, "c, f");
       
      Parameters:
      col - the column index
      row - the row index
      encodedAlignments - describes the horizontal and vertical alignments
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • xy

      public final FormBuilder xy(int col, int row, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
      Sets the column and row origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.

      Examples:

       .add(aComponent).xy(1, 3, CellConstraints.LEFT,   CellConstraints.BOTTOM);
       .add(aComponent).xy(1, 3, CellConstraints.CENTER, CellConstraints.FILL);
       
      Parameters:
      col - the column index
      row - the row index
      colAlign - horizontal component alignment
      rowAlign - vertical component alignment
      Returns:
      a reference to the builder
    • xyw

      public final FormBuilder xyw(int col, int row, int colSpan)
      Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

      Examples:

       .add(aComponent).xyw(1, 3, 7);
       .add(aComponent).xyw(1, 3, 2);
       
      Parameters:
      col - the column index
      row - the row index
      colSpan - the column span or grid width
      Returns:
      a reference to the builder
    • xyw

      public final FormBuilder xyw(int col, int row, int colSpan, String encodedAlignments)
      Sets the column, row, width, and height; decodes the horizontal and vertical alignments from the given string. The row span (height) is set to 1.

      Examples:

       .add(aComponent).xyw(1, 3, 7, "left, bottom")
       .add(aComponent).xyw(1, 3, 7, "l, b");
       .add(aComponent).xyw(1, 3, 2, "center, fill");
       .add(aComponent).xyw(1, 3, 2, "c, f");
       
      Parameters:
      col - the column index
      row - the row index
      colSpan - the column span or grid width
      encodedAlignments - describes the horizontal and vertical alignments
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • xyw

      public final FormBuilder xyw(int col, int row, int colSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
      Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects. The row span (height) is set to 1.

      Examples:

       .add(aComponent).xyw(1, 3, 2, CellConstraints.LEFT,   CellConstraints.BOTTOM);
       .add(aComponent).xyw(1, 3, 7, CellConstraints.CENTER, CellConstraints.FILL);
       
      Parameters:
      col - the column index
      row - the row index
      colSpan - the column span or grid width
      colAlign - horizontal component alignment
      rowAlign - vertical component alignment
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • xywh

      public final FormBuilder xywh(int col, int row, int colSpan, int rowSpan)
      Sets the column, row, width, and height; uses default alignments.

      Examples:

       .add(aComponent).xywh(1, 3, 2, 1);
       .add(aComponent).xywh(1, 3, 7, 3);
       
      Parameters:
      col - the column index
      row - the row index
      colSpan - the column span or grid width
      rowSpan - the row span or grid height
      Returns:
      a reference to the builder
    • xywh

      public final FormBuilder xywh(int col, int row, int colSpan, int rowSpan, String encodedAlignments)
      Sets the column, row, width, and height; decodes the horizontal and vertical alignments from the given string.

      Examples:

       .add(aComponent).xywh(1, 3, 2, 1, "left, bottom");
       .add(aComponent).xywh(1, 3, 2, 1, "l, b");
       .add(aComponent).xywh(1, 3, 7, 3, "center, fill");
       .add(aComponent).xywh(1, 3, 7, 3, "c, f");
       
      Parameters:
      col - the column index
      row - the row index
      colSpan - the column span or grid width
      rowSpan - the row span or grid height
      encodedAlignments - describes the horizontal and vertical alignments
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • xywh

      public final FormBuilder xywh(int col, int row, int colSpan, int rowSpan, CellConstraints.Alignment colAlign, CellConstraints.Alignment rowAlign)
      Sets the column, row, width, and height; sets the horizontal and vertical alignment using the specified alignment objects.

      Examples:

       .add(aComponent).xywh(1, 3, 2, 1, CellConstraints.LEFT,   CellConstraints.BOTTOM);
       .add(aComponent).xywh(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL);
       
      Parameters:
      col - the column index
      row - the row index
      colSpan - the column span or grid width
      rowSpan - the row span or grid height
      colAlign - horizontal component alignment
      rowAlign - vertical component alignment
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • rc

      public final FormBuilder rc(int row, int col)
      Sets row and column origins; sets height and width to 1; uses the default alignments.

      Examples:

       .add(aComponent).rc(1, 1)
       .add(aComponent).rc(3, 1)
       
      Parameters:
      row - the row index
      col - the column index
      Returns:
      a reference to the builder
    • rc

      public final FormBuilder rc(int row, int col, String encodedAlignments)
      Sets row and column origins; sets height and width to 1; decodes vertical and horizontal alignments from the given string.

      Examples:

       .add(aComponent).rc(3, 1, "bottom, left")
       .add(aComponent).rc(3, 1, "b, l")
       .add(aComponent).rc(3, 1, "fill, center")
       .add(aComponent).rc(3, 1, "f, c")
       
      Parameters:
      row - the row index
      col - the column index
      encodedAlignments - describes the vertical and horizontal alignments
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • rc

      public final FormBuilder rc(int row, int col, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
      Sets the row and column origins; sets width and height to 1; set horizontal and vertical alignment using the specified objects.

      Examples:

       .add(aComponent).rc(3, 1, CellConstraints.BOTTOM, CellConstraints.LEFT);
       .add(aComponent).rc(3, 1, CellConstraints.FILL,   CellConstraints.CENTER);
       
      Parameters:
      row - the row index
      col - the column index
      rowAlign - vertical component alignment
      colAlign - horizontal component alignment
      Returns:
      a reference to the builder
    • rcw

      public final FormBuilder rcw(int row, int col, int colSpan)
      Sets the row, column, height, and width; uses a height (row span) of 1 and the vertical and horizontal default alignments.

      Examples:

       .add(aComponent).rcw(3, 1, 7);
       .add(aComponent).rcw(3, 1, 2);
       
      Parameters:
      row - the row index
      col - the column index
      colSpan - the column span or grid width
      Returns:
      a reference to the builder
    • rcw

      public final FormBuilder rcw(int row, int col, int colSpan, String encodedAlignments)
      Sets the row, column, height, and width; decodes the vertical and horizontal alignments from the given string. The row span (height) is set to 1.

      Examples:

       .add(aComponent).rcw(3, 1, 7, "bottom, left");
       .add(aComponent).rcw(3, 1, 7, "b, l");
       .add(aComponent).rcw(3, 1, 2, "fill, center");
       .add(aComponent).rcw(3, 1, 2, "f, c");
       
      Parameters:
      row - the row index
      col - the column index
      colSpan - the column span or grid width
      encodedAlignments - describes the vertical and horizontal alignments
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • rcw

      public final FormBuilder rcw(int row, int col, int colSpan, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
      Sets the row, column, height, and width; sets the vertical and horizontal alignment using the specified alignment objects. The row span (height) is set to 1.

      Examples:

       .add(aComponent).rcw(3, 1, 2, CellConstraints.BOTTOM, CellConstraints.LEFT);
       .add(aComponent).rcw(3, 1, 7, CellConstraints.FILL,   CellConstraints.CENTER);
       
      Parameters:
      row - the row index
      col - the column index
      colSpan - the column span or grid width
      rowAlign - vertical component alignment
      colAlign - horizontal component alignment
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • rchw

      public final FormBuilder rchw(int row, int col, int rowSpan, int colSpan)
      Sets the row, column, height, and width; uses default alignments.

      Examples:

       .add(aComponent).rchw(1, 3, 2, 1);
       .add(aComponent).rchw(1, 3, 7, 3);
       
      Parameters:
      row - the row index
      col - the column index
      rowSpan - the row span or grid height
      colSpan - the column span or grid width
      Returns:
      a reference to the builder
    • rchw

      public final FormBuilder rchw(int row, int col, int rowSpan, int colSpan, String encodedAlignments)
      Sets the row, column, height, and width; decodes the vertical and horizontal alignments from the given string.

      Examples:

       .add(aComponent).rchw(3, 1, 1, 2, "bottom, left");
       .add(aComponent).rchw(3, 1, 1, 2, "b, l");
       .add(aComponent).rchw(3, 1, 3, 7, "fill, center");
       .add(aComponent).rchw(3, 1, 3, 7, "f, c");
       
      Parameters:
      row - the row index
      col - the column index
      rowSpan - the row span or grid height
      colSpan - the column span or grid width
      encodedAlignments - describes the vertical and horizontal alignments
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • rchw

      public final FormBuilder rchw(int row, int col, int rowSpan, int colSpan, CellConstraints.Alignment rowAlign, CellConstraints.Alignment colAlign)
      Sets the row, column, height, and width; sets the vertical and horizontal alignment using the specified alignment objects.

      Examples:

       .add(aComponent).rchw(3, 1, 1, 2, CellConstraints.BOTTOM, CellConstraints.LEFT);
       .add(aComponent).rchw(3, 1, 3, 7, CellConstraints.FILL,   CellConstraints.CENTER);
       
      Parameters:
      row - the row index
      col - the column index
      rowSpan - the row span or grid height
      colSpan - the column span or grid width
      rowAlign - vertical component alignment
      colAlign - horizontal component alignment
      Returns:
      a reference to the builder
      Throws:
      IllegalArgumentException - if an alignment orientation is invalid
    • add

      protected FormBuilder add(CellConstraints constraints)