Class 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 Detail

      • ComponentBehavior

        public ComponentBehavior()
    • 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)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • clone

        public ComponentBehavior clone()
        Create a new object, which is an exact copy of this one.
        Overrides:
        clone in class Object
        Returns:
        a clone of this object.
      • apply

        public ComponentBehavior apply​(BehaviorModifier... modifiers)
        Returns a modified copy of the behavior.
        Parameters:
        modifiers - modifications to run.
        Returns:
        A modified clone of this behavior.