[Chapter 19] Insets
Author: John Zukowski
Date: Thu Jul 31 15:13:58 1997

#

| Chapter 19 java.awt Reference |

# Insets

## Name

Insets

##

## Description

The `Insets` class provides a way to encapsulate the layout margins of the four different sides of a `Container`.

## Class Definition

    public class java.awt.Insets
        extends java.lang.Object
        implements java.io.Serializable, java.lang.Cloneable {

      // Variables
      public int bottom;
      public int left;
      public int right;
      public int top;

      // Constructors
      public Insets (int top, int left, int bottom, int right);

      // Instance Methods
      public Object clone();
      public boolean equals (Object obj);
      public String toString();
    }

## Variables

### bottom

#### public int bottom

The border width for the bottom of a `Container`.

### left

#### public int left

The border width for the left side of a `Container`.

### right

#### public int right

The border width for the right side of a `Container`.

### top

#### public int top

The border width for the top of a `Container`.

## Constructors

### Insets

#### public Insets (int top, int left, int bottom, int right)

Parameters

  top

    The border width for the top of a `Container`.

  left

    The border width for the left side of a `Container`.

  bottom

    The border width for the bottom of a `Container`.

  right

    The border width for the right side of a `Container`.

Description

  Constructs an `Insets` object with the appropriate border settings.

## Instance Methods

### clone

#### public Object clone()

Returns

  Clone of original object.

Overrides

  `Object.clone()`

Description

  Creates a copy of the original instance of an object.

### equals

#### public boolean equals (Object obj)

Parameters

  obj

    The object to be tested.

Returns

  `true` if the objects are equal; `false` otherwise.

Overrides

  `Object.equals(Object)`

Description

  Tests two `Insets` objects for equality.

### toString

#### public String toString()

Returns

  A string representation of the `Insets` object.

Overrides

  `Object.toString()`

## See Also

`Cloneable`, `Container`, `Object`, `Serializable`, `String`

Image |  | ItemSelectable