home *** CD-ROM | disk | FTP | other *** search
/ Chip: Shareware for Win 95 / Chip-Shareware-Win95.bin / ostatni / powerj / java.z / Insets.java < prev    next >
Encoding:
Java Source  |  1996-05-03  |  2.2 KB  |  86 lines

  1. /*
  2.  * @(#)Insets.java    1.8 95/12/01 Arthur van Hoff
  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.  
  20. package java.awt;
  21.  
  22. /**
  23.  * The insets of a container.
  24.  * This class is used to layout containers.
  25.  *
  26.  * @see LayoutManager
  27.  * @see Container
  28.  *
  29.  * @version     1.8, 01 Dec 1995
  30.  * @author     Arthur van Hoff
  31.  * @author     Sami Shaio
  32.  */
  33. public class Insets implements Cloneable {
  34.  
  35.     /**
  36.      * The inset from the top.
  37.      */
  38.     public int top;
  39.  
  40.     /**
  41.      * The inset from the left.
  42.      */
  43.     public int left;
  44.  
  45.     /**
  46.      * The inset from the bottom.
  47.      */
  48.     public int bottom;
  49.  
  50.     /**
  51.      * The inset from the right.
  52.      */
  53.     public int right;
  54.  
  55.     /**
  56.      * Constructs and initializes a new Inset with the specified top,
  57.      * left, bottom, and right insets.
  58.      * @param top the inset from the top
  59.      * @param left the inset from the left
  60.      * @param bottom the inset from the bottom
  61.      * @param right the inset from the right
  62.      */
  63.     public Insets(int top, int left, int bottom, int right) {
  64.     this.top = top;
  65.     this.left = left;
  66.     this.bottom = bottom;
  67.     this.right = right;
  68.     }
  69.  
  70.     /**
  71.      * Returns a String object representing this Inset's values.
  72.      */
  73.     public String toString() {
  74.     return getClass().getName() + "[top="  + top + ",left=" + left + ",bottom=" + bottom + ",right=" + right + "]";
  75.     }
  76.  
  77.     public Object clone() { 
  78.     try { 
  79.         return super.clone();
  80.     } catch (CloneNotSupportedException e) { 
  81.         // this shouldn't happen, since we are Cloneable
  82.         throw new InternalError();
  83.     }
  84.     }
  85. }
  86.