home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / java.z / GridBagConstraints.java < prev    next >
Text File  |  1996-05-03  |  3KB  |  85 lines

  1. /*
  2.  * @(#)GridBagConstraints.java    1.5 95/12/01 Doug Stein
  3.  *
  4.  * Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19. package java.awt;
  20.  
  21. /**
  22.  * GridBagConstraints is used to specify constraints for components
  23.  * laid out using the GridBagLayout class.
  24.  *
  25.  * @see java.awt.GridBagLayout
  26.  * @version 1.5, 01 Dec 1995
  27.  * @author Doug Stein
  28.  */
  29. public class GridBagConstraints implements Cloneable {
  30.   public static final int RELATIVE = -1;
  31.   public static final int REMAINDER = 0;
  32.  
  33.   public static final int NONE = 0;
  34.   public static final int BOTH = 1;
  35.   public static final int HORIZONTAL = 2;
  36.   public static final int VERTICAL = 3;
  37.  
  38.   public static final int CENTER = 10;
  39.   public static final int NORTH = 11;
  40.   public static final int NORTHEAST = 12;
  41.   public static final int EAST = 13;
  42.   public static final int SOUTHEAST = 14;
  43.   public static final int SOUTH = 15;
  44.   public static final int SOUTHWEST = 16;
  45.   public static final int WEST = 17;
  46.   public static final int NORTHWEST = 18;
  47.  
  48.   public int gridx, gridy, gridwidth, gridheight;
  49.   public double weightx, weighty;
  50.   public int anchor, fill;
  51.   public Insets insets;
  52.   public int ipadx, ipady;
  53.  
  54.   int tempX, tempY;
  55.   int tempWidth, tempHeight;
  56.   int minWidth, minHeight;
  57.  
  58.   public GridBagConstraints () {
  59.     gridx = RELATIVE;
  60.     gridy = RELATIVE;
  61.     gridwidth = 1;
  62.     gridheight = 1;
  63.  
  64.     weightx = 0;
  65.     weighty = 0;
  66.     anchor = CENTER;
  67.     fill = NONE;
  68.  
  69.     insets = new Insets(0, 0, 0, 0);
  70.     ipadx = 0;
  71.     ipady = 0;
  72.   }
  73.  
  74.   public Object clone () {
  75.       try { 
  76.       GridBagConstraints c = (GridBagConstraints)super.clone();
  77.       c.insets = (Insets)insets.clone();
  78.       return c;
  79.       } catch (CloneNotSupportedException e) { 
  80.       // this shouldn't happen, since we are Cloneable
  81.       throw new InternalError();
  82.       }
  83.   }
  84. }
  85.