Interface InCellGapProvider
public interface InCellGapProvider
An interface to implement if you want to decide the gaps between two types of components within the same cell.
E.g.:
`if (adjacentComp == null || adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.TOP)
return null;
boolean isHor = (adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.RIGHT);
if (adjacentComp.getComponentType(false) == ComponentWrapper.TYPE_LABEL && comp.getComponentType(false) == ComponentWrapper.TYPE_TEXT_FIELD)
return isHor ? UNRELATED_Y : UNRELATED_Y;
return (adjacentSide == SwingConstants.LEFT || adjacentSide == SwingConstants.RIGHT) ? RELATED_X : RELATED_Y;`
-
Method Summary
Modifier and TypeMethodDescriptiongetDefaultGap(ComponentWrapper comp, ComponentWrapper adjacentComp, int adjacentSide, String tag, boolean isLTR) Returns the default gap between two components that are in the same cell.
-
Method Details
-
getDefaultGap
BoundSize getDefaultGap(ComponentWrapper comp, ComponentWrapper adjacentComp, int adjacentSide, String tag, boolean isLTR) Returns the default gap between two components that are in the same cell.
Parameters
-
comp: The component that the gap is for. Nevernull. -
adjacentComp: The adjacent component if any. May benull. -
adjacentSide: @param adjacentSide What side theadjacentCompis on.javax.swing.SwingUtilities#TOPorjavax.swing.SwingUtilities#LEFTorjavax.swing.SwingUtilities#BOTTOMorjavax.swing.SwingUtilities#RIGHT. -
tag: The tag string that the component might be tagged with in the component constraints. May benull. -
isLTR: If it is left-to-right.
Returns
The default gap between two components or
nullif there should be no gap. -
-