public abstract class LayoutCallback

  1. Object
  2. LayoutCallback

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.

Constructors

public LayoutCallback()

Methods

public UnitValue[] getPosition(ComponentWrapper comp)Returns a position similar to the “pos” the component constraint.
public BoundSize[] getSize(ComponentWrapper comp)Returns a size similar to the “width” and “height” in the component constraint.
public void correctBounds(ComponentWrapper comp)A last minute change of the bounds.

Inherited methods

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 ComponentWrapper
The component wrapper that holds the actual component (JComponent is Swing and Control in SWT). Should not be altered.

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 ComponentWrapper
The component wrapper that holds the actual component (JComponent is Swing and Control in SWT). Should not be altered.

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 ComponentWrapper
The component wrapper that holds the actual component (JComponent is Swing and Control in SWT).