Class AnchorConstraint

java.lang.Object
com.cloudgarden.layout.AnchorConstraint

public class AnchorConstraint extends Object
Used by both AnchorLayout (SWT) and AnchorLayoutManager (Swing)
  • Field Details

    • ANCHOR_NONE

      public static final int ANCHOR_NONE
      Meaning: This side is not anchored.
      See Also:
      Constant Field Values
    • ANCHOR_REL

      public static final int ANCHOR_REL
      (Relative anchor) Meaning: This side is anchored so that it always occurs a fixed fraction of the distance along it's parent's side. The position is calculated by the formula " position = (parent side)*(value)/1000 " so for instance if top=100 and topType == ANCHOR_REL then the value of y for this side would be (parent height)*top/1000.
      See Also:
      Constant Field Values
    • ANCHOR_ABS

      public static final int ANCHOR_ABS
      (Absolute anchor) Meaning: This side is anchored a fixed distance in pixels (given by the value for this side) from it's parent's respective side. For instance, if bottomType == ANCHOR_ABS and bottom = 100 then the bottom side of this component will remain fixed 100 pixels from the bottom side of it's parent container.
      See Also:
      Constant Field Values
    • top

      public int top
    • bottom

      public int bottom
    • left

      public int left
    • topType

      public int topType
    • bottomType

      public int bottomType
    • rightType

      public int rightType
    • leftType

      public int leftType
  • Constructor Details

    • AnchorConstraint

      public AnchorConstraint()
    • AnchorConstraint

      public AnchorConstraint(int top, int right, int bottom, int left, int topType, int rightType, int bottomType, int leftType)
      Creates an AnchorConstraint.
      Parameters:
      top - - value (relative or absolute) for top side
      right - - like 'top' but for right side
      bottom - - like 'top' but for bottom side
      left - - like 'top' but for left side
      topType - - either ANCHOR_ABS, ANCHOR_REL or ANCHOR_NONE to indicate whether the 'top' parameter is an absolute value (in pixels) or a fractional value (in 1/1000 ths) of the height of this component's parent, denoting where the anchor will be applied (if at all).
      rightType - - like 'topType' but for right side
      bottomType - - like 'topType' but for bottom side
      leftType - - like 'topType' but for left side