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

Print this page


   1 /*
   2  * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 350      */
 351     public BorderLayout() {
 352         this(0, 0);
 353     }
 354 
 355     /**
 356      * Constructs a border layout with the specified gaps
 357      * between components.
 358      * The horizontal gap is specified by <code>hgap</code>
 359      * and the vertical gap is specified by <code>vgap</code>.
 360      * @param   hgap   the horizontal gap.
 361      * @param   vgap   the vertical gap.
 362      */
 363     public BorderLayout(int hgap, int vgap) {
 364         this.hgap = hgap;
 365         this.vgap = vgap;
 366     }
 367 
 368     /**
 369      * Returns the horizontal gap between components.


 370      * @since   JDK1.1
 371      */
 372     public int getHgap() {
 373         return hgap;
 374     }
 375 
 376     /**
 377      * Sets the horizontal gap between components.

 378      * @param hgap the horizontal gap between components
 379      * @since   JDK1.1
 380      */
 381     public void setHgap(int hgap) {
 382         this.hgap = hgap;
 383     }
 384 
 385     /**
 386      * Returns the vertical gap between components.


 387      * @since   JDK1.1
 388      */
 389     public int getVgap() {
 390         return vgap;
 391     }
 392 
 393     /**
 394      * Sets the vertical gap between components.

 395      * @param vgap the vertical gap between components
 396      * @since   JDK1.1
 397      */
 398     public void setVgap(int vgap) {
 399         this.vgap = vgap;
 400     }
 401 
 402     /**
 403      * Adds the specified component to the layout, using the specified
 404      * constraint object.  For border layouts, the constraint must be
 405      * one of the following constants:  <code>NORTH</code>,
 406      * <code>SOUTH</code>, <code>EAST</code>,
 407      * <code>WEST</code>, or <code>CENTER</code>.
 408      * <p>
 409      * Most applications do not call this method directly. This method
 410      * is called when a component is added to a container using the
 411      * <code>Container.add</code> method with the same argument types.
 412      * @param   comp         the component to be added.
 413      * @param   constraints  an object that specifies how and where
 414      *                       the component is added to the layout.


   1 /*
   2  * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 350      */
 351     public BorderLayout() {
 352         this(0, 0);
 353     }
 354 
 355     /**
 356      * Constructs a border layout with the specified gaps
 357      * between components.
 358      * The horizontal gap is specified by <code>hgap</code>
 359      * and the vertical gap is specified by <code>vgap</code>.
 360      * @param   hgap   the horizontal gap.
 361      * @param   vgap   the vertical gap.
 362      */
 363     public BorderLayout(int hgap, int vgap) {
 364         this.hgap = hgap;
 365         this.vgap = vgap;
 366     }
 367 
 368     /**
 369      * Returns the horizontal gap between components.
 370      *
 371      * @return the horizontal gap between components
 372      * @since JDK1.1
 373      */
 374     public int getHgap() {
 375         return hgap;
 376     }
 377 
 378     /**
 379      * Sets the horizontal gap between components.
 380      *
 381      * @param hgap the horizontal gap between components
 382      * @since   JDK1.1
 383      */
 384     public void setHgap(int hgap) {
 385         this.hgap = hgap;
 386     }
 387 
 388     /**
 389      * Returns the vertical gap between components.
 390      *
 391      * @return the vertical gap between components
 392      * @since JDK1.1
 393      */
 394     public int getVgap() {
 395         return vgap;
 396     }
 397 
 398     /**
 399      * Sets the vertical gap between components.
 400      *
 401      * @param vgap the vertical gap between components
 402      * @since   JDK1.1
 403      */
 404     public void setVgap(int vgap) {
 405         this.vgap = vgap;
 406     }
 407 
 408     /**
 409      * Adds the specified component to the layout, using the specified
 410      * constraint object.  For border layouts, the constraint must be
 411      * one of the following constants:  <code>NORTH</code>,
 412      * <code>SOUTH</code>, <code>EAST</code>,
 413      * <code>WEST</code>, or <code>CENTER</code>.
 414      * <p>
 415      * Most applications do not call this method directly. This method
 416      * is called when a component is added to a container using the
 417      * <code>Container.add</code> method with the same argument types.
 418      * @param   comp         the component to be added.
 419      * @param   constraints  an object that specifies how and where
 420      *                       the component is added to the layout.