Documentation of 'org.bounce.FormLayout' Java class
FormLayout
org.bounce

Class FormLayout

  • All Implemented Interfaces:
    java.awt.LayoutManager, java.awt.LayoutManager2


    public class FormLayout
    extends java.lang.Object
    implements java.awt.LayoutManager2
    A Layout manager that can be used to layout 2 columns of components. The alignment and fill type of the columns can be set by using the FormConstraint class.
    A couple of predefined FormConstraint objects have been defined:
    • LEFT, Places the component in the left column of the form.
    • RIGHT, Places the component in the right column of the form.
    • RIGHT_FILL, Places the component in the right column of the form and fills the component so it takes up the maximum horizontal space.
    • FULL, The component takes up both the left and right column, and is aligned to the left of the row.
    • FULL_FILL, The component takes up both the left and right column, and is set to fill the whole width of the row.
    Notes:
    - Alignment of components that fill the height or width completely already will not result in a visible change. Ie. the full positioned component will never react to a Vertical alignment setting.
    - The fill method will only change the horizontal appearance.
    - Components that are bigger than the available width/height will be LEFT aligned.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static FormConstraints FULL
      A constraint that allows the component to use the total width of the form.
      static FormConstraints FULL_FILL
      A constraint that allows the component to use the total width of the form and resizes the component to fill the whole width.
      static FormConstraints LEFT
      A constraint that adds the component to the left side of the form.
      static FormConstraints RIGHT
      A constraint that adds the component to the right side of the form.
      static FormConstraints RIGHT_FILL
      A constraint that adds the component to the right side of the form and resizes the component to fill the whole available width.
    • Constructor Summary

      Constructors 
      Constructor and Description
      FormLayout()
      Constructs a default FormLayout without any horizontal or vertical gaps.
      FormLayout(int hGap, int vGap)
      Constructs a FormLayout with the specified horizontal and vertical gap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addLayoutComponent(java.awt.Component component, java.lang.Object constraints)
      Adds the specified component to the layout, using the specified constraint object.
      void addLayoutComponent(java.lang.String name, java.awt.Component comp)
      Not used, components cannot be added without a constraint.
      int getHgap()
      Returns the horizontal gap between the left column and the right column.
      float getLayoutAlignmentX(java.awt.Container target)
      Returns the alignment along the x axis.
      float getLayoutAlignmentY(java.awt.Container target)
      Returns the alignment along the y axis.
      int getVgap()
      Returns the vertical gap between the rows.
      void invalidateLayout(java.awt.Container target)
      Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
      void layoutContainer(java.awt.Container parent)
      Lays out the components on the specified container.
      java.awt.Dimension maximumLayoutSize(java.awt.Container target)
      Returns the maximum size of this component.
      java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
      Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
      java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
      Calculates the preferred size dimensions for the specified container given the components in the specified parent container.
      void removeLayoutComponent(java.awt.Component component)
      Removes the specified component and constraints from the layout.
      void setConstraints(java.awt.Component component, java.lang.Object constraint)
      Adds the specified component to the layout, using the specified constraint object.
      void setHgap(int hGap)
      Sets the horizontal gap between the left column and the right column.
      void setVgap(int vGap)
      Returns the vertical gap between the rows.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LEFT

        public static final FormConstraints LEFT
        A constraint that adds the component to the left side of the form.
      • RIGHT

        public static final FormConstraints RIGHT
        A constraint that adds the component to the right side of the form.
      • RIGHT_FILL

        public static final FormConstraints RIGHT_FILL
        A constraint that adds the component to the right side of the form and resizes the component to fill the whole available width.
      • FULL

        public static final FormConstraints FULL
        A constraint that allows the component to use the total width of the form.
      • FULL_FILL

        public static final FormConstraints FULL_FILL
        A constraint that allows the component to use the total width of the form and resizes the component to fill the whole width.
    • Constructor Detail

      • FormLayout

        public FormLayout()
        Constructs a default FormLayout without any horizontal or vertical gaps.
      • FormLayout

        public FormLayout(int hGap,
                          int vGap)
        Constructs a FormLayout with the specified horizontal and vertical gap.
        Parameters:
        hGap - the horizontal gap between the left and right components.
        vGap - the vertical gap between the rows.
    • Method Detail

      • getHgap

        public int getHgap()
        Returns the horizontal gap between the left column and the right column.
        Returns:
        the horizontal gap.
      • setHgap

        public void setHgap(int hGap)
        Sets the horizontal gap between the left column and the right column.
        Parameters:
        hGap - the horizontal gap between the columns
      • getVgap

        public int getVgap()
        Returns the vertical gap between the rows.
        Returns:
        the vertical gap.
      • setVgap

        public void setVgap(int vGap)
        Returns the vertical gap between the rows.
        Parameters:
        vGap - the vertical gap between the rows
      • setConstraints

        public void setConstraints(java.awt.Component component,
                                   java.lang.Object constraint)
        Adds the specified component to the layout, using the specified constraint object. For Form layouts, the constraint must be an instance of the FormConstraints class.
        Parameters:
        component - the component added to the parent container.
        constraint - the constraint for the added component.
      • removeLayoutComponent

        public void removeLayoutComponent(java.awt.Component component)
        Removes the specified component and constraints from the layout.
        Specified by:
        removeLayoutComponent in interface java.awt.LayoutManager
        Parameters:
        component - the component to be removed
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
        Calculates the preferred size dimensions for the specified container given the components in the specified parent container.
        Specified by:
        preferredLayoutSize in interface java.awt.LayoutManager
        Parameters:
        parent - the component to be laid out.
        Returns:
        the preferred size of the layout.
      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
        Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
        Specified by:
        minimumLayoutSize in interface java.awt.LayoutManager
        Parameters:
        parent - the component to be laid out
        Returns:
        the minimum size of the layout.
      • layoutContainer

        public void layoutContainer(java.awt.Container parent)
        Lays out the components on the specified container.
        Specified by:
        layoutContainer in interface java.awt.LayoutManager
        Parameters:
        parent - the component which needs to be laid out
      • addLayoutComponent

        public void addLayoutComponent(java.awt.Component component,
                                       java.lang.Object constraints)
        Adds the specified component to the layout, using the specified constraint object.
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager2
        Parameters:
        component - the component to be added
        constraints - where/how the component is added to the layout.
      • maximumLayoutSize

        public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
        Returns the maximum size of this component.
        Specified by:
        maximumLayoutSize in interface java.awt.LayoutManager2
        Parameters:
        target - the component to be laid out
        Returns:
        the maximum size of the layout.
        See Also:
        Component.getMinimumSize(), Component.getPreferredSize()
      • getLayoutAlignmentX

        public float getLayoutAlignmentX(java.awt.Container target)
        Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
        Specified by:
        getLayoutAlignmentX in interface java.awt.LayoutManager2
        Parameters:
        target - the container to calculate X alignment for.
        Returns:
        the X alignment.
      • getLayoutAlignmentY

        public float getLayoutAlignmentY(java.awt.Container target)
        Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
        Specified by:
        getLayoutAlignmentY in interface java.awt.LayoutManager2
        Parameters:
        target - the container to calculate Y alignment for.
        Returns:
        the Y alignment.
      • invalidateLayout

        public void invalidateLayout(java.awt.Container target)
        Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
        Specified by:
        invalidateLayout in interface java.awt.LayoutManager2
        Parameters:
        target - the container.
      • addLayoutComponent

        public void addLayoutComponent(java.lang.String name,
                                       java.awt.Component comp)
        Not used, components cannot be added without a constraint.
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager
        Parameters:
        name - the component name.
        comp - the component.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.