# Class LayoutCallback

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

public abstract class LayoutCallback extends Object

A class to extend if you want to provide more control over where a component is placed or the size of it.

Note! Returned arrays from this class will never be altered. This means that caching of arrays in these methods is OK.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LayoutCallback()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `correctBounds(ComponentWrapper comp)`
  A last minute change of the bounds.
  `UnitValue[]`
  `getPosition(ComponentWrapper comp)`
  Returns a position similar to the "pos" the component constraint.
  `BoundSize[]`
  `getSize(ComponentWrapper comp)`
  Returns a size similar to the "width" and "height" in the component constraint.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### LayoutCallback

    public LayoutCallback()

- ## Method Details

  - ### getPosition

    public UnitValue[] getPosition(ComponentWrapper comp)

    Returns a position similar to the "pos" the component constraint.

    ###### Parameters

    - `comp`: @param comp The component wrapper that holds the actual component (JComponent is Swing and Control in SWT). Should not be altered.

    ###### Returns

    Returns:

      The [x, y, x2, y2] as explained in the documentation for "pos". If `null` is returned nothing is done and this is the default.

      ###### See also

      - UnitValue

      - net.miginfocom.layout.ConstraintParser#parseUnitValue(String, boolean)

  - ### getSize

    public BoundSize[] getSize(ComponentWrapper comp)

    Returns a size similar to the "width" and "height" in the component constraint.

    ###### Parameters

    - `comp`: @param comp The component wrapper that holds the actual component (JComponent is Swing and Control in SWT). Should not be altered.

    ###### Returns

    Returns:

      The [width, height] as explained in the documentation for "width" and "height". If `null` is returned nothing is done and this is the default.

      ###### See also

      - net.miginfocom.layout.BoundSize

      - net.miginfocom.layout.ConstraintParser#parseBoundSize(String, boolean, boolean)

  - ### correctBounds

    public void correctBounds(ComponentWrapper comp)

    A last minute change of the bounds. The bound for the layout cycle has been set and you can correct there after any set of rules you like.

    ###### Parameters

    - `comp`: The component wrapper that holds the actual component (JComponent is Swing and Control in SWT).