src/java.desktop/share/classes/java/awt/BorderLayout.java

Print this page




  57  * In a container whose <code>ComponentOrientation</code> is set to
  58  * <code>ComponentOrientation.LEFT_TO_RIGHT</code>, these constants map to
  59  * <code>NORTH</code>, <code>SOUTH</code>, <code>WEST</code>, and
  60  * <code>EAST</code>, respectively.
  61  * <p>
  62  * For compatibility with previous releases, <code>BorderLayout</code>
  63  * also includes the relative positioning constants <code>BEFORE_FIRST_LINE</code>,
  64  * <code>AFTER_LAST_LINE</code>, <code>BEFORE_LINE_BEGINS</code> and
  65  * <code>AFTER_LINE_ENDS</code>.  These are equivalent to
  66  * <code>PAGE_START</code>, <code>PAGE_END</code>, <code>LINE_START</code>
  67  * and <code>LINE_END</code> respectively.  For
  68  * consistency with the relative positioning constants used by other
  69  * components, the latter constants are preferred.
  70  * <p>
  71  * Mixing both absolute and relative positioning constants can lead to
  72  * unpredictable results.  If
  73  * you use both types, the relative constants will take precedence.
  74  * For example, if you add components using both the <code>NORTH</code>
  75  * and <code>PAGE_START</code> constants in a container whose
  76  * orientation is <code>LEFT_TO_RIGHT</code>, only the
  77  * <code>PAGE_START</code> will be layed out.
  78  * <p>
  79  * NOTE: Currently (in the Java 2 platform v1.2),
  80  * <code>BorderLayout</code> does not support vertical
  81  * orientations.  The <code>isVertical</code> setting on the container's
  82  * <code>ComponentOrientation</code> is not respected.
  83  * <p>
  84  * The components are laid out according to their
  85  * preferred sizes and the constraints of the container's size.
  86  * The <code>NORTH</code> and <code>SOUTH</code> components may
  87  * be stretched horizontally; the <code>EAST</code> and
  88  * <code>WEST</code> components may be stretched vertically;
  89  * the <code>CENTER</code> component may stretch both horizontally
  90  * and vertically to fill any space left over.
  91  * <p>
  92  * Here is an example of five buttons in an applet laid out using
  93  * the <code>BorderLayout</code> layout manager:
  94  * <p>
  95  * <img src="doc-files/BorderLayout-1.gif"
  96  * alt="Diagram of an applet demonstrating BorderLayout.
  97  *      Each section of the BorderLayout contains a Button corresponding to its position in the layout, one of:


 194      * Constant to specify components location to be the
 195      *      center portion of the border layout.
 196      * @serial
 197      * @see #getChild(String, boolean)
 198      * @see #addLayoutComponent
 199      * @see #getLayoutAlignmentX
 200      * @see #getLayoutAlignmentY
 201      * @see #removeLayoutComponent
 202      */
 203         Component center;
 204 
 205     /**
 206      *
 207      * A relative positioning constant, that can be used instead of
 208      * north, south, east, west or center.
 209      * mixing the two types of constants can lead to unpredictable results.  If
 210      * you use both types, the relative constants will take precedence.
 211      * For example, if you add components using both the <code>NORTH</code>
 212      * and <code>BEFORE_FIRST_LINE</code> constants in a container whose
 213      * orientation is <code>LEFT_TO_RIGHT</code>, only the
 214      * <code>BEFORE_FIRST_LINE</code> will be layed out.
 215      * This will be the same for lastLine, firstItem, lastItem.
 216      * @serial
 217      */
 218     Component firstLine;
 219      /**
 220      * A relative positioning constant, that can be used instead of
 221      * north, south, east, west or center.
 222      * Please read Description for firstLine.
 223      * @serial
 224      */
 225         Component lastLine;
 226      /**
 227      * A relative positioning constant, that can be used instead of
 228      * north, south, east, west or center.
 229      * Please read Description for firstLine.
 230      * @serial
 231      */
 232         Component firstItem;
 233     /**
 234      * A relative positioning constant, that can be used instead of




  57  * In a container whose <code>ComponentOrientation</code> is set to
  58  * <code>ComponentOrientation.LEFT_TO_RIGHT</code>, these constants map to
  59  * <code>NORTH</code>, <code>SOUTH</code>, <code>WEST</code>, and
  60  * <code>EAST</code>, respectively.
  61  * <p>
  62  * For compatibility with previous releases, <code>BorderLayout</code>
  63  * also includes the relative positioning constants <code>BEFORE_FIRST_LINE</code>,
  64  * <code>AFTER_LAST_LINE</code>, <code>BEFORE_LINE_BEGINS</code> and
  65  * <code>AFTER_LINE_ENDS</code>.  These are equivalent to
  66  * <code>PAGE_START</code>, <code>PAGE_END</code>, <code>LINE_START</code>
  67  * and <code>LINE_END</code> respectively.  For
  68  * consistency with the relative positioning constants used by other
  69  * components, the latter constants are preferred.
  70  * <p>
  71  * Mixing both absolute and relative positioning constants can lead to
  72  * unpredictable results.  If
  73  * you use both types, the relative constants will take precedence.
  74  * For example, if you add components using both the <code>NORTH</code>
  75  * and <code>PAGE_START</code> constants in a container whose
  76  * orientation is <code>LEFT_TO_RIGHT</code>, only the
  77  * <code>PAGE_START</code> will be laid out.
  78  * <p>
  79  * NOTE: Currently (in the Java 2 platform v1.2),
  80  * <code>BorderLayout</code> does not support vertical
  81  * orientations.  The <code>isVertical</code> setting on the container's
  82  * <code>ComponentOrientation</code> is not respected.
  83  * <p>
  84  * The components are laid out according to their
  85  * preferred sizes and the constraints of the container's size.
  86  * The <code>NORTH</code> and <code>SOUTH</code> components may
  87  * be stretched horizontally; the <code>EAST</code> and
  88  * <code>WEST</code> components may be stretched vertically;
  89  * the <code>CENTER</code> component may stretch both horizontally
  90  * and vertically to fill any space left over.
  91  * <p>
  92  * Here is an example of five buttons in an applet laid out using
  93  * the <code>BorderLayout</code> layout manager:
  94  * <p>
  95  * <img src="doc-files/BorderLayout-1.gif"
  96  * alt="Diagram of an applet demonstrating BorderLayout.
  97  *      Each section of the BorderLayout contains a Button corresponding to its position in the layout, one of:


 194      * Constant to specify components location to be the
 195      *      center portion of the border layout.
 196      * @serial
 197      * @see #getChild(String, boolean)
 198      * @see #addLayoutComponent
 199      * @see #getLayoutAlignmentX
 200      * @see #getLayoutAlignmentY
 201      * @see #removeLayoutComponent
 202      */
 203         Component center;
 204 
 205     /**
 206      *
 207      * A relative positioning constant, that can be used instead of
 208      * north, south, east, west or center.
 209      * mixing the two types of constants can lead to unpredictable results.  If
 210      * you use both types, the relative constants will take precedence.
 211      * For example, if you add components using both the <code>NORTH</code>
 212      * and <code>BEFORE_FIRST_LINE</code> constants in a container whose
 213      * orientation is <code>LEFT_TO_RIGHT</code>, only the
 214      * <code>BEFORE_FIRST_LINE</code> will be laid out.
 215      * This will be the same for lastLine, firstItem, lastItem.
 216      * @serial
 217      */
 218     Component firstLine;
 219      /**
 220      * A relative positioning constant, that can be used instead of
 221      * north, south, east, west or center.
 222      * Please read Description for firstLine.
 223      * @serial
 224      */
 225         Component lastLine;
 226      /**
 227      * A relative positioning constant, that can be used instead of
 228      * north, south, east, west or center.
 229      * Please read Description for firstLine.
 230      * @serial
 231      */
 232         Component firstItem;
 233     /**
 234      * A relative positioning constant, that can be used instead of