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
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()
-
Constructor Details
-
ComponentBehavior
public ComponentBehavior()
-
-
Method Details
-
getLineAlign
- Returns:
- Alignment along the line axis.
-
setLineAlign
-
isLineStretch
public boolean isLineStretch()- Returns:
- Should the component be stretched along the line axis.
-
setLineStretch
public void setLineStretch(boolean lineStretch) -
getPageAlign
- Returns:
- Alignment along the page axis.
-
setPageAlign
-
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
- Returns:
- insets for the component.
-
setInsets
-
equals
-
hashCode
public int hashCode() -
clone
Create a new object, which is an exact copy ofthisone. -
toString
-
apply
Returns a modified copy of the behavior.- Parameters:
modifiers- modifications to run.- Returns:
- A modified clone of
thisbehavior.
-