Example usage for com.jgoodies.forms.layout CellConstraints CellConstraints

List of usage examples for com.jgoodies.forms.layout CellConstraints CellConstraints

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints CellConstraints.

Prototype

public CellConstraints(int gridX, int gridY, int gridWidth, int gridHeight, Alignment hAlign,
        Alignment vAlign) 

Source Link

Document

Constructs an instance of CellConstraints for the given cell position and size, anchor, and fill.

Examples:

 new CellConstraints(1, 3, 2, 1, CellConstraints.LEFT,   CellConstraints.BOTTOM); new CellConstraints(1, 3, 7, 3, CellConstraints.CENTER, CellConstraints.FILL); 

Usage

From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java

License:Apache License

private static CellConstraints gridToCellConstraints(final RadComponent component) {
    GridConstraints gc = component.getConstraints();
    CellConstraints.Alignment hAlign = ((gc.getHSizePolicy() & GridConstraints.SIZEPOLICY_WANT_GROW) != 0)
            ? CellConstraints.FILL// www .  j  a va  2 s  .  c o m
            : CellConstraints.DEFAULT;
    CellConstraints.Alignment vAlign = ((gc.getVSizePolicy() & GridConstraints.SIZEPOLICY_WANT_GROW) != 0)
            ? CellConstraints.FILL
            : CellConstraints.DEFAULT;
    if (component.getCustomLayoutConstraints() instanceof CellConstraints) {
        CellConstraints cc = (CellConstraints) component.getCustomLayoutConstraints();
        hAlign = cc.hAlign;
        vAlign = cc.vAlign;
    }
    return new CellConstraints(gc.getColumn() + 1, gc.getRow() + 1, gc.getColSpan(), gc.getRowSpan(), hAlign,
            vAlign);
}

From source file:com.salas.bb.utils.uif.BBFormBuilder.java

License:Open Source License

/**
 * Appends component with defined column span and aligning properties.
 *
 * @param c             component./*  w ww .j a v a  2s  . c  o  m*/
 * @param columnSpan    column span.
 * @param horiz         horizontal alignment.
 * @param vert          vertical alignment.
 */
public void append(Component c, int columnSpan, CellConstraints.Alignment horiz,
        CellConstraints.Alignment vert) {
    builder.append("");

    int column = builder.getColumn() - 2;
    builder.setColumn(column);

    CellConstraints cc = new CellConstraints(column, builder.getRow(), columnSpan, 1, horiz, vert);

    builder.add(c, cc);
    builder.nextColumn(columnSpan + 1);
}