# Class AC

java.lang.Object
com.codename1.ui.layouts.mig.AC

public final class AC extends java.lang.Object

A constraint that holds the column or row constraints for the grid. It also holds the gaps between the rows and columns.

This class is a holder and builder for a number of `net.miginfocom.layout.DimConstraint`s.

For a more thorough explanation of what these constraints do, and how to build the constraints, see the White Paper or Cheat Sheet at www.migcomponents.com.

Note that there are two way to build this constraint. Through String (e.g. `"[100]3[200,fill]"` or through API (E.g. `new AC().size("100").gap("3").size("200").fill()`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AC()`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AC`
  `align(String side)`
  Specifies the current row/column's columns default alignment for its components.
  `AC`
  `align(String side, int... indexes)`
  Specifies the indicated rows'/columns' columns default alignment for its components.
  `AC`
  `count(int size)`
  Sets the total number of rows/columns to `size`.
  `AC`
  `fill()`
  Specifies that the current row/column's component should grow by default.
  `AC`
  `fill(int... indexes)`
  Specifies that the indicated rows'/columns' component should grow by default.
  `AC`
  `gap()`
  Specifies the gap size to be the default one AND moves to the next column/row.
  `AC`
  `gap(String size)`
  Specifies the gap size to `size` AND moves to the next column/row.
  `AC`
  `gap(String size, int... indexes)`
  Specifies the indicated rows'/columns' gap size to `size`.
  `DimConstraint[]`
  `getConstaints()`
  Property.
  `int`
  `getCount()`
  Returns the number of rows/columns that this constraints currently have.
  `AC`
  `grow()`
  Specifies the current row/column's grow weight within columns/rows with the `grow priority` 100f.
  `AC`
  `grow(float w)`
  Specifies the current row/column's grow weight within columns/rows with the same `grow priority`.
  `AC`
  `grow(float w, int... indexes)`
  Specifies the indicated rows'/columns' grow weight within columns/rows with the same `grow priority`.
  `AC`
  `growPrio(int p)`
  Specifies the current row/column's grow priority.
  `AC`
  `growPrio(int p, int... indexes)`
  Specifies the indicated rows'/columns' grow priority.
  `AC`
  `index(int i)`
  Sets the current row/column to `i`.
  `AC`
  `noGrid()`
  Specifies that the current row/column should not be grid-like.
  `AC`
  `noGrid(int... indexes)`
  Specifies that the indicated rows/columns should not be grid-like.
  `void`
  `setConstaints(DimConstraint[] constr)`
  Sets the different `net.miginfocom.layout.DimConstraint`s that this object should consists of.
  `AC`
  `shrink()`
  Specifies that the current row/column's shrink weight withing the columns/rows with the `shrink priority` 100f.
  `AC`
  `shrink(float w)`
  Specifies that the current row/column's shrink weight withing the columns/rows with the same `shrink priority`.
  `AC`
  `shrink(float w, int... indexes)`
  Specifies the indicated rows'/columns' shrink weight withing the columns/rows with the same `shrink priority`.
  `AC`
  `shrinkPrio(int p)`
  Specifies the current row/column's shrink priority.
  `AC`
  `shrinkPrio(int p, int... indexes)`
  Specifies the indicated rows'/columns' shrink priority.
  `AC`
  `shrinkWeight(float w)`
  Specifies that the current row/column's shrink weight withing the columns/rows with the same `shrink priority`.
  `AC`
  `shrinkWeight(float w, int... indexes)`
  Specifies the indicated rows'/columns' shrink weight withing the columns/rows with the same `shrink priority`.
  `AC`
  `size(String s)`
  Specifies the current row/column's min and/or preferred and/or max size.
  `AC`
  `size(String size, int... indexes)`
  Specifies the indicated rows'/columns' min and/or preferred and/or max size.
  `AC`
  `sizeGroup()`
  Specifies that the current row/column should be put in the size group `s` and will thus share the same size constraints as the other components in the group.
  `AC`
  `sizeGroup(String s)`
  Specifies that the current row/column should be put in the size group `s` and will thus share the same size constraints as the other components in the group.
  `AC`
  `sizeGroup(String s, int... indexes)`
  Specifies that the indicated rows/columns should be put in the size group `s` and will thus share the same size constraints as the other components in the group.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AC

    public AC()
    Constructor. Creates an instance that can be configured manually. Will be initialized with a default `net.miginfocom.layout.DimConstraint`.

- ## Method Details

  - ### getConstaints

    public DimConstraint[] getConstaints()

    Property. The different `net.miginfocom.layout.DimConstraint`s that this object consists of. These `DimConstraints` contains all information in this class.

    Yes, we are embarrassingly aware that the method is misspelled.

    ###### Returns

    Returns:
      The different `net.miginfocom.layout.DimConstraint`s that this object consists of. A new list and never `null`.

  - ### setConstaints

    public void setConstaints(DimConstraint[] constr)

    Sets the different `net.miginfocom.layout.DimConstraint`s that this object should consists of.

    Yes, we are embarrassingly aware that the method is misspelled.

    ###### Parameters

    - `constr`: @param constr The different `net.miginfocom.layout.DimConstraint`s that this object consists of. The list will be copied for storage. `null` or and empty array will reset the constraints to one `DimConstraint` with default values.

  - ### getCount

    public int getCount()

    Returns the number of rows/columns that this constraints currently have.

    ###### Returns

    The number of rows/columns that this constraints currently have. At least 1.

  - ### count

    public AC count(int size)

    Sets the total number of rows/columns to `size`. If the number of rows/columns is already more than `size` nothing will happen.

    ###### Parameters

    - `size`: The total number of rows/columns

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### noGrid

    public AC noGrid()

    Specifies that the current row/column should not be grid-like. The while row/colum will have its components layed out in one single cell. It is the same as to say that the cells in this column/row will all be merged (a.k.a spanned).

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### noGrid

    public AC noGrid(int... indexes)

    Specifies that the indicated rows/columns should not be grid-like. The while row/colum will have its components layed out in one single cell. It is the same as to say that the cells in this column/row will all be merged (a.k.a spanned).

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### index

    public AC index(int i)

    Sets the current row/column to `i`. If the current number of rows/columns is less than `i` a call to `#count(int)` will set the size accordingly.

    The next call to any of the constraint methods (e.g. `net.miginfocom.layout.AC#noGrid`) will be carried out on this new row/column.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `i`: The new current row/column.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### fill

    public AC fill()

    Specifies that the current row/column's component should grow by default. It does not affect the size of the row/column.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### fill

    public AC fill(int... indexes)

    Specifies that the indicated rows'/columns' component should grow by default. It does not affect the size of the row/column.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### sizeGroup

    public AC sizeGroup()

    Specifies that the current row/column should be put in the size group `s` and will thus share the same size constraints as the other components in the group.

    Same as `sizeGroup("")`

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Since

    3.7.2

  - ### sizeGroup

    public AC sizeGroup(String s)

    Specifies that the current row/column should be put in the size group `s` and will thus share the same size constraints as the other components in the group.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `s`: A name to associate on the group that should be the same for other rows/columns in the same group.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### sizeGroup

    public AC sizeGroup(String s, int... indexes)

    Specifies that the indicated rows/columns should be put in the size group `s` and will thus share the same size constraints as the other components in the group.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `s`: A name to associate on the group that should be the same for other rows/columns in the same group.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### size

    public AC size(String s)

    Specifies the current row/column's min and/or preferred and/or max size. E.g. `"10px"` or `"50:100:200"`.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `s`: @param s The minimum and/or preferred and/or maximum size of this row. The string will be interpreted as a BoundSize. For more info on how BoundSize is formatted see the documentation.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### size

    public AC size(String size, int... indexes)

    Specifies the indicated rows'/columns' min and/or preferred and/or max size. E.g. `"10px"` or `"50:100:200"`.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `size`: @param size The minimum and/or preferred and/or maximum size of this row. The string will be interpreted as a BoundSize. For more info on how BoundSize is formatted see the documentation.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### gap

    public AC gap()

    Specifies the gap size to be the default one AND moves to the next column/row. The method is called `.gap()` rather the more natural `.next()` to indicate that it is very much related to the other `.gap(..)` methods.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### gap

    public AC gap(String size)

    Specifies the gap size to `size` AND moves to the next column/row.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `size`: @param size minimum and/or preferred and/or maximum size of the gap between this and the next row/column. The string will be interpreted as a BoundSize. For more info on how BoundSize is formatted see the documentation.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### gap

    public AC gap(String size, int... indexes)

    Specifies the indicated rows'/columns' gap size to `size`.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `size`: @param size minimum and/or preferred and/or maximum size of the gap between this and the next row/column. The string will be interpreted as a BoundSize. For more info on how BoundSize is formatted see the documentation.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### align

    public AC align(String side)

    Specifies the current row/column's columns default alignment for its components. It does not affect the positioning or size of the columns/row itself. For columns it is the horizonal alignment (e.g. "left") and for rows it is the vertical alignment (e.g. "top").

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `side`: The default side to align the components. E.g. "top" or "left", or "leading" or "trailing" or "bottom" or "right".

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### align

    public AC align(String side, int... indexes)

    Specifies the indicated rows'/columns' columns default alignment for its components. It does not affect the positioning or size of the columns/row itself. For columns it is the horizonal alignment (e.g. "left") and for rows it is the vertical alignment (e.g. "top").

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `side`: The default side to align the components. E.g. "top" or "left", or "before" or "after" or "bottom" or "right".

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### growPrio

    public AC growPrio(int p)

    Specifies the current row/column's grow priority.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `p`: The new grow priority.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### growPrio

    public AC growPrio(int p, int... indexes)

    Specifies the indicated rows'/columns' grow priority.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `p`: The new grow priority.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### grow

    public AC grow()

    Specifies the current row/column's grow weight within columns/rows with the `grow priority` 100f.

    Same as `grow(100f)`

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Since

    3.7.2

  - ### grow

    public AC grow(float w)

    Specifies the current row/column's grow weight within columns/rows with the same `grow priority`.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `w`: The new grow weight.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### grow

    public AC grow(float w, int... indexes)

    Specifies the indicated rows'/columns' grow weight within columns/rows with the same `grow priority`.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `w`: The new grow weight.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### shrinkPrio

    public AC shrinkPrio(int p)

    Specifies the current row/column's shrink priority.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `p`: The new shrink priority.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### shrinkPrio

    public AC shrinkPrio(int p, int... indexes)

    Specifies the indicated rows'/columns' shrink priority.

    For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `p`: The new shrink priority.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

  - ### shrink

    public AC shrink()

    Specifies that the current row/column's shrink weight withing the columns/rows with the `shrink priority` 100f.

    Same as `shrink(100f)`.

    For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Since

    3.7.2

  - ### shrink

    public AC shrink(float w)

    Specifies that the current row/column's shrink weight withing the columns/rows with the same `shrink priority`.

    For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `w`: The shrink weight.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Since

    3.7.2

  - ### shrink

    public AC shrink(float w, int... indexes)

    Specifies the indicated rows'/columns' shrink weight withing the columns/rows with the same `shrink priority`.

    For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `w`: The shrink weight.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Since

    3.7.2

  - ### shrinkWeight

    public AC shrinkWeight(float w)

    Specifies that the current row/column's shrink weight withing the columns/rows with the same `shrink priority`.

    For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `w`: The shrink weight.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Deprecated

    in 3.7.2. Use `#shrink(float)` instead.

  - ### shrinkWeight

    public AC shrinkWeight(float w, int... indexes)

    Specifies the indicated rows'/columns' shrink weight withing the columns/rows with the same `shrink priority`.

    For a more thorough explanation of what this constraint does see the White Paper or Cheat Sheet at www.migcomponents.com.

    ###### Parameters

    - `w`: The shrink weight.

    - `indexes`: The index(es) (0-based) of the columns/rows that should be affected by this constraint.

    ###### Returns

    `this` so it is possible to chain calls. E.g. `new AxisConstraint().noGrid().gap().fill()`.

    ###### Deprecated

    in 3.7.2. Use `int...)` instead.