Class ComponentBehavior
- java.lang.Object
-
- io.codeworth.panelmatic.componentbehavior.ComponentBehavior
-
- All Implemented Interfaces:
Cloneable
public class ComponentBehavior extends Object implements Cloneable
Tells the component how to behave spatially (alignment, stretching etc.). Each component gets space. Components can be stretched to fill that space (on the page axis, the line axis, or on both). If the components do not fill the space, they can be aligned in it. The page grow factor tells the builder how much of the free space (if any) the component's space should get. This is very much like the weights in
GridBagLayout. grow factor of 0 tells the panel the component should get its preferred size.Normally, client code will not deal directly with instances of this class, and would rather use one of the
Modifiers.- Author:
- michaelbar-sinai
-
-
Constructor Summary
Constructors Constructor Description ComponentBehavior()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComponentBehaviorapply(BehaviorModifier... modifiers)Returns a modified copy of the behavior.ComponentBehaviorclone()Create a new object, which is an exact copy ofthisone.booleanequals(Object obj)InsetsgetInsets()LineAligngetLineAlign()PageAligngetPageAlign()doublegetPageGrowFactor()inthashCode()booleanisLineStretch()booleanisPageStretch()voidsetInsets(Insets insets)voidsetLineAlign(LineAlign lineAlign)voidsetLineStretch(boolean lineStretch)voidsetPageAlign(PageAlign pageAlign)voidsetPageGrowFactor(double pageGrowFactor)voidsetPageStretch(boolean pageStretch)StringtoString()
-
-
-
Method Detail
-
getLineAlign
public LineAlign getLineAlign()
- Returns:
- Alignment along the line axis.
-
setLineAlign
public void setLineAlign(LineAlign lineAlign)
-
isLineStretch
public boolean isLineStretch()
- Returns:
- Should the component be stretched along the line axis.
-
setLineStretch
public void setLineStretch(boolean lineStretch)
-
getPageAlign
public PageAlign getPageAlign()
- Returns:
- Alignment along the page axis.
-
setPageAlign
public void setPageAlign(PageAlign pageAlign)
-
isPageStretch
public boolean isPageStretch()
- Returns:
- Should the component be stretched along the page axis.
-
setPageStretch
public void setPageStretch(boolean pageStretch)
-
getPageGrowFactor
public double getPageGrowFactor()
- Returns:
- Component's weight along the page axis.
-
setPageGrowFactor
public void setPageGrowFactor(double pageGrowFactor)
-
getInsets
public Insets getInsets()
- Returns:
- insets for the component.
-
setInsets
public void setInsets(Insets insets)
-
clone
public ComponentBehavior clone()
Create a new object, which is an exact copy ofthisone.
-
apply
public ComponentBehavior apply(BehaviorModifier... modifiers)
Returns a modified copy of the behavior.- Parameters:
modifiers- modifications to run.- Returns:
- A modified clone of
thisbehavior.
-
-