Class BorderLayout

  • All Implemented Interfaces:
    Serializable

    public class BorderLayout
    extends PercentLayoutBase

    A GUI library independent implementation of the AWT layout manager BorderLayout.

    This layout manager implements the BorderLayout functionality based on the PercentLayout layout manager. Because of that it can be used for all platforms for which an adapter is available.

    This implementation differs from the original BorderLayout in only a few points: Margins can be defined around the hosting container and individual gaps are supported between all hosted components. These margins and gaps can be specified using all supported units.

    Version:
    $Id: BorderLayout.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    See Also:
    Serialized Form
    • Constructor Detail

      • BorderLayout

        public BorderLayout()
        Creates a new instance of BorderLayout.
    • Method Detail

      • getBottomMargin

        public NumberWithUnit getBottomMargin()
        Returns the bottom margin.
        Returns:
        the bottom margin
      • setBottomMargin

        public void setBottomMargin​(NumberWithUnit bottomMargin)
        Sets the bottom margin.
        Parameters:
        bottomMargin - the bottom margin
      • getEastGap

        public NumberWithUnit getEastGap()
        Returns the east gap.
        Returns:
        the east gap
      • setEastGap

        public void setEastGap​(NumberWithUnit eastGap)
        Sets the east gap. This is a gap between the center and the east component.
        Parameters:
        eastGap - the east gap
      • getLeftMargin

        public NumberWithUnit getLeftMargin()
        Returns the left margin.
        Returns:
        the left margin
      • setLeftMargin

        public void setLeftMargin​(NumberWithUnit leftMargin)
        Sets the left margin.
        Parameters:
        leftMargin - the left margin
      • getNorthGap

        public NumberWithUnit getNorthGap()
        Returns the north gap.
        Returns:
        the north gap
      • setNorthGap

        public void setNorthGap​(NumberWithUnit northGap)
        Sets the north gap. This is a gap between the north and the center component.
        Parameters:
        northGap - the north gap
      • getRightMargin

        public NumberWithUnit getRightMargin()
        Returns the right margin.
        Returns:
        the right margin
      • setRightMargin

        public void setRightMargin​(NumberWithUnit rightMargin)
        Sets the right margin.
        Parameters:
        rightMargin - the right margin
      • getSouthGap

        public NumberWithUnit getSouthGap()
        Returns the south gap.
        Returns:
        the south gap
      • setSouthGap

        public void setSouthGap​(NumberWithUnit southGap)
        Sets the south gap. This is a gap between the south and the center component.
        Parameters:
        southGap - the south gap
      • getTopMargin

        public NumberWithUnit getTopMargin()
        Returns the top margin.
        Returns:
        the top margin
      • setTopMargin

        public void setTopMargin​(NumberWithUnit topMargin)
        Sets the top margin.
        Parameters:
        topMargin - the top margin
      • getWestGap

        public NumberWithUnit getWestGap()
        Returns the west gap.
        Returns:
        the west gap
      • setWestGap

        public void setWestGap​(NumberWithUnit westGap)
        Sets the west gap. This is a gap between the west and the center component.
        Parameters:
        westGap - the west gap
      • initCells

        protected void initCells​(PercentLayoutPlatformAdapter adapter)
        Initializes the percent layout. This implementation creates a layout with 7 columns and 7 rows and places the contained components in the appropriate cells according to their constraints.
        Specified by:
        initCells in class PercentLayoutBase
        Parameters:
        adapter - the platform adapter
      • initConstraints

        protected void initConstraints​(boolean north,
                                       boolean south,
                                       boolean west,
                                       boolean east)
        Initializes the column and row constraints for the percent layout. They depend on the occupied positions in the border layout.
        Parameters:
        north - flag whether the north position is occupied
        south - flag whether the south position is occupied
        west - flag whether the west position is occupied
        east - flag whether the east position is occupied