<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.awt.BorderLayout
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.AWTEventMulticaster.html#_top_">Previous</a>  <a href="java.awt.Button.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.awt.BorderLayout
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.awt.BorderLayout
</pre>
<hr>
<dl>
  <dt> public class <b>BorderLayout</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
  <dt> implements <a href="java.awt.LayoutManager2.html#_top_">LayoutManager2</a>, <a href="java.io.Serializable.html#_top_">Serializable</a>
</dl>
A border layout lays out a container, arranging and resizing
 its components to fit in five regions:
 <code>North</code>, <code>South</code>, <code>East</code>, 
 <code>West</code>, and <code>Center</code>.  When adding a 
 component to a container with a border layout, use one of these
 five names, for example:
 <pre>
    Panel p = new Panel();
    p.setLayout(new BorderLayout());
    p.add(new Button("Okay"), "South");
 </pre>
 As a convenience, BorderLayout interprets the absence of a string
 specification the same as "Center":
 <pre>
    Panel p2 = new Panel();
    p2.setLayout(new BorderLayout());
    p2.add(new TextArea());  // Same as p.add(new TextArea(), "Center");
 </pre>
 <p>
 The components are laid out according to their 
 preferred sizes and the constraints of the container's size. 
 The <code>North</code> and <code>South</code> components may 
 be stretched horizontally; the <code>East</code> and 
 <code>West</code> components may be stretched vertically; 
 the <code>Center</code> component may stretch both horizontally 
 and vertically to fill any space left over. 
 <p>
 Here is an example of five buttons in an applet laid out using 
 the <code>BorderLayout</code> layout manager:
 <p>
 <img src="images-awt/BorderLayout-1.gif"
 ALIGN=center HSPACE=10 VSPACE=7>
 <p>
 The code for this applet is as follows: 
 <p>
 <hr><blockquote><pre>
 import java.awt.*;
 import java.applet.Applet;
 public class buttonDir extends Applet {
   public void init() {
     setLayout(new BorderLayout());
     add("North",  new Button("North"));
     add("South",  new Button("South"));
     add("East",   new Button("East"));
     add("West",   new Button("West"));
     add("Center", new Button("Center"));
   }
 }
 </pre></blockquote><hr>
 <p>
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="#java.awt.Container.add(String, Component)">java.awt.Container.add</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#CENTER"><b>CENTER</b></a>
  <dd>  The center layout constraint (middle of container).
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#EAST"><b>EAST</b></a>
  <dd>  The east layout constraint (left side of container).
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#NORTH"><b>NORTH</b></a>
  <dd>  The north layout constraint (top of container).
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SOUTH"><b>SOUTH</b></a>
  <dd>  The south layout constraint (bottom of container).
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#WEST"><b>WEST</b></a>
  <dd>  The west layout constraint (right side of container).
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BorderLayout()"><b>BorderLayout</b></a>()
  <dd>  Constructs a new border layout with  
 no gaps between components.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BorderLayout(int, int)"><b>BorderLayout</b></a>(int, int)
  <dd>  Constructs a border layout with the specified gaps 
 between components.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addLayoutComponent(java.awt.Component, java.lang.Object)"><b>addLayoutComponent</b></a>(Component, Object)
  <dd>  Adds the specified component to the layout, using the specified
 constraint object.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addLayoutComponent(java.lang.String, java.awt.Component)"><b>addLayoutComponent</b></a>(String, Component)
  <dd>  
<b>Deprecated.</b>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getHgap()"><b>getHgap</b></a>()
  <dd>  Returns the horizontal gap between components.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getLayoutAlignmentX(java.awt.Container)"><b>getLayoutAlignmentX</b></a>(Container)
  <dd>  Returns the alignment along the x axis.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getLayoutAlignmentY(java.awt.Container)"><b>getLayoutAlignmentY</b></a>(Container)
  <dd>  Returns the alignment along the y axis.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getVgap()"><b>getVgap</b></a>()
  <dd>  Returns the vertical gap between components.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#invalidateLayout(java.awt.Container)"><b>invalidateLayout</b></a>(Container)
  <dd>  Invalidates the layout, indicating that if the layout manager
 has cached information it should be discarded.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#layoutContainer(java.awt.Container)"><b>layoutContainer</b></a>(Container)
  <dd>  Lays out the container argument using this border layout.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#maximumLayoutSize(java.awt.Container)"><b>maximumLayoutSize</b></a>(Container)
  <dd>  Returns the maximum dimensions for this layout given the components
 in the specified target container.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#minimumLayoutSize(java.awt.Container)"><b>minimumLayoutSize</b></a>(Container)
  <dd>  Determines the minimum size of the <code>target</code> container 
 using this layout manager.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#preferredLayoutSize(java.awt.Container)"><b>preferredLayoutSize</b></a>(Container)
  <dd>  Determines the preferred size of the <code>target</code> 
 container using this layout manager, based on the components
 in the container.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#removeLayoutComponent(java.awt.Component)"><b>removeLayoutComponent</b></a>(Component)
  <dd>  Removes the specified component from this border layout.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setHgap(int)"><b>setHgap</b></a>(int)
  <dd>  Sets the horizontal gap between components.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setVgap(int)"><b>setVgap</b></a>(int)
  <dd>  Sets the vertical gap between components.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Returns a string representation of the state of this border layout.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="NORTH"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>NORTH</b>
<pre>
 public static final <a href="java.lang.String.html#_top_">String</a> NORTH
</pre>
<dl>
  <dd> The north layout constraint (top of container).<p>
</dl>
<a name="SOUTH"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>SOUTH</b>
<pre>
 public static final <a href="java.lang.String.html#_top_">String</a> SOUTH
</pre>
<dl>
  <dd> The south layout constraint (bottom of container).<p>
</dl>
<a name="EAST"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>EAST</b>
<pre>
 public static final <a href="java.lang.String.html#_top_">String</a> EAST
</pre>
<dl>
  <dd> The east layout constraint (left side of container).<p>
</dl>
<a name="WEST"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>WEST</b>
<pre>
 public static final <a href="java.lang.String.html#_top_">String</a> WEST
</pre>
<dl>
  <dd> The west layout constraint (right side of container).<p>
</dl>
<a name="CENTER"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>CENTER</b>
<pre>
 public static final <a href="java.lang.String.html#_top_">String</a> CENTER
</pre>
<dl>
  <dd> The center layout constraint (middle of container).<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="BorderLayout"></a>
<a name="BorderLayout()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BorderLayout</b>
<pre>
 public BorderLayout()
</pre>
<dl>
  <dd> Constructs a new border layout with  
 no gaps between components.
<p>
</dl>
<a name="BorderLayout(int, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BorderLayout</b>
<pre>
 public BorderLayout(int hgap,
                     int vgap)
</pre>
<dl>
  <dd> Constructs a border layout with the specified gaps 
 between components.
 The horizontal gap is specified by <code>hgap</code> 
 and the vertical gap is specified by <code>vgap</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> hgap - the horizontal gap.
    <dd> vgap - the vertical gap.
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="getHgap()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getHgap"><b>getHgap</b></a>
<pre>
 public int getHgap()
</pre>
<dl>
  <dd> Returns the horizontal gap between components.
<p>
</dl>
<a name="setHgap(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setHgap"><b>setHgap</b></a>
<pre>
 public void setHgap(int hgap)
</pre>
<dl>
  <dd> Sets the horizontal gap between components.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> hgap - the horizontal gap between components
  </dl></dd>
</dl>
<a name="getVgap()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getVgap"><b>getVgap</b></a>
<pre>
 public int getVgap()
</pre>
<dl>
  <dd> Returns the vertical gap between components.
<p>
</dl>
<a name="setVgap(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setVgap"><b>setVgap</b></a>
<pre>
 public void setVgap(int vgap)
</pre>
<dl>
  <dd> Sets the vertical gap between components.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> vgap - the vertical gap between components
  </dl></dd>
</dl>
<a name="addLayoutComponent(java.awt.Component, java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addLayoutComponent"><b>addLayoutComponent</b></a>
<pre>
 public void addLayoutComponent(<a href="java.awt.Component.html#_top_">Component</a> comp,
                                <a href="java.lang.Object.html#_top_">Object</a> constraints)
</pre>
<dl>
  <dd> Adds the specified component to the layout, using the specified
 constraint object.  For border layouts, the constraint must be
 one of the following strings:  <code>"North"</code>,
 <code>"South"</code>, <code>"East"</code>,
 <code>"West"</code>, or <code>"Center"</code>.  
 <p>
 Most applications do not call this method directly. This method 
 is called when a component is added to a container using the 
 <code>Container.add</code> method with the same argument types.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> comp - the component to be added.
    <dd> constraints - an object that specifies how and where
                       the component is added to the layout.
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> if the constraint object is not
                 a string, or if it not one of the five specified strings.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Container.html#add(java.awt.Component, java.lang.Object)">add</a>
  </dl></dd>
</dl>
<a name="addLayoutComponent(java.lang.String, java.awt.Component)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addLayoutComponent"><b>addLayoutComponent</b></a>
<pre>
 public void addLayoutComponent(<a href="java.lang.String.html#_top_">String</a> name,
                                <a href="java.awt.Component.html#_top_">Component</a> comp)
</pre>
<dl>
<dd><b> Note: addLayoutComponent() is deprecated.</b>
<i>replaced by <code>addLayoutComponent(Component, Object)</code>.</i>
<p>
</dl>
<a name="removeLayoutComponent(java.awt.Component)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="removeLayoutComponent"><b>removeLayoutComponent</b></a>
<pre>
 public void removeLayoutComponent(<a href="java.awt.Component.html#_top_">Component</a> comp)
</pre>
<dl>
  <dd> Removes the specified component from this border layout. This 
 method is called when a container calls its <code>remove</code> or 
 <code>removeAll</code> methods. Most applications do not call this 
 method directly.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> comp - the component to be removed.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Container.html#remove(java.awt.Component)">remove</a>, <a href="java.awt.Container.html#removeAll()">removeAll</a>
  </dl></dd>
</dl>
<a name="minimumLayoutSize(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="minimumLayoutSize"><b>minimumLayoutSize</b></a>
<pre>
 public <a href="java.awt.Dimension.html#_top_">Dimension</a> minimumLayoutSize(<a href="java.awt.Container.html#_top_">Container</a> target)
</pre>
<dl>
  <dd> Determines the minimum size of the <code>target</code> container 
 using this layout manager. 
 <p>
 This method is called when a container calls its 
 <code>getMinimumSize</code> method. Most applications do not call 
 this method directly.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> target - the container in which to do the layout.
    <dt> <b>Returns:</b>
    <dd> the minimum dimensions needed to lay out the subcomponents
          of the specified container.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Container.html#_top_">Container</a>, <a href="#preferredLayoutSize">preferredLayoutSize</a>, <a href="java.awt.Container.html#getMinimumSize()">getMinimumSize</a>
  </dl></dd>
</dl>
<a name="preferredLayoutSize(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="preferredLayoutSize"><b>preferredLayoutSize</b></a>
<pre>
 public <a href="java.awt.Dimension.html#_top_">Dimension</a> preferredLayoutSize(<a href="java.awt.Container.html#_top_">Container</a> target)
</pre>
<dl>
  <dd> Determines the preferred size of the <code>target</code> 
 container using this layout manager, based on the components
 in the container. 
 <p>
 Most applications do not call this method directly. This method
 is called when a container calls its <code>getPreferredSize</code> 
 method.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> target - the container in which to do the layout.
    <dt> <b>Returns:</b>
    <dd> the preferred dimensions to lay out the subcomponents
          of the specified container.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Container.html#_top_">Container</a>, <a href="#minimumLayoutSize">minimumLayoutSize</a>, <a href="java.awt.Container.html#getPreferredSize()">getPreferredSize</a>
  </dl></dd>
</dl>
<a name="maximumLayoutSize(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="maximumLayoutSize"><b>maximumLayoutSize</b></a>
<pre>
 public <a href="java.awt.Dimension.html#_top_">Dimension</a> maximumLayoutSize(<a href="java.awt.Container.html#_top_">Container</a> target)
</pre>
<dl>
  <dd> Returns the maximum dimensions for this layout given the components
 in the specified target container.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> target - the component which needs to be laid out
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Container.html#_top_">Container</a>, <a href="#minimumLayoutSize">minimumLayoutSize</a>, <a href="#preferredLayoutSize">preferredLayoutSize</a>
  </dl></dd>
</dl>
<a name="getLayoutAlignmentX(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLayoutAlignmentX"><b>getLayoutAlignmentX</b></a>
<pre>
 public float getLayoutAlignmentX(<a href="java.awt.Container.html#_top_">Container</a> parent)
</pre>
<dl>
  <dd> 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.
<p>
</dl>
<a name="getLayoutAlignmentY(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLayoutAlignmentY"><b>getLayoutAlignmentY</b></a>
<pre>
 public float getLayoutAlignmentY(<a href="java.awt.Container.html#_top_">Container</a> parent)
</pre>
<dl>
  <dd> 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.
<p>
</dl>
<a name="invalidateLayout(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="invalidateLayout"><b>invalidateLayout</b></a>
<pre>
 public void invalidateLayout(<a href="java.awt.Container.html#_top_">Container</a> target)
</pre>
<dl>
  <dd> Invalidates the layout, indicating that if the layout manager
 has cached information it should be discarded.
<p>
</dl>
<a name="layoutContainer(java.awt.Container)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="layoutContainer"><b>layoutContainer</b></a>
<pre>
 public void layoutContainer(<a href="java.awt.Container.html#_top_">Container</a> target)
</pre>
<dl>
  <dd> Lays out the container argument using this border layout. 
 <p>
 This method actually reshapes the components in the specified
 container in order to satisfy the constraints of this 
 <code>BorderLayout</code> object. The <code>North</code> 
 and <code>South</code>components, if any, are placed at 
 the top and bottom of the container, respectively. The 
 <code>West</code> and <code>East</code> components are 
 then placed on the left and right, respectively. Finally, 
 the <code>Center</code> object is placed in any remaining 
 space in the middle. 
 <p>
 Most applications do not call this method directly. This method 
 is called when a container calls its <code>doLayout</code> method.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> target - the container in which to do the layout.
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.Container.html#_top_">Container</a>, <a href="java.awt.Container.html#doLayout()">doLayout</a>
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Returns a string representation of the state of this border layout.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a string representation of this border layout.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.html">This Package</a>  <a href="java.awt.AWTEventMulticaster.html#_top_">Previous</a>  <a href="java.awt.Button.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
