APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt

public Class Insets

extends Object
implements Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable
Known Direct Subclasses
javax.swing.plaf.InsetsUIResource
Imports
java.io.Serial

An Insets object is a representation of the borders of a container. It specifies the space that a container must leave at each of its edges. The space can be a border, a blank space, or a title.
Authors
Arthur van Hoff, Sami Shaio
Since
1.0
See Also
java.awt.LayoutManager, java.awt.Container

Field Summary

Modifier and TypeField and Description
public int
bottom

The inset from the bottom.

public int
left

The inset from the left.

public int
right

The inset from the right.

private static final long
serialVersionUID

Use serialVersionUID from JDK 1.1 for interoperability.

public int
top

The inset from the top.

Constructor Summary

AccessConstructor and Description
public
Insets(int
the inset from the top.
top
,
int
the inset from the left.
left
,
int
the inset from the bottom.
bottom
,
int
the inset from the right.
right
)

Creates and initializes a new Insets object with the specified top, left, bottom, and right insets.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a copy of this Insets object.
clone
()

Overrides java.lang.Object.clone.

Create a copy of this object.

public boolean

Returns:

true if the two insets are equal; otherwise false.
equals
(Object obj)

Overrides java.lang.Object.equals.

Checks whether two insets objects are equal.

public int

Returns:

a hash code for this Insets.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code for this Insets.

private static native void
initIDs()

Initialize JNI field and method IDs

public void
set(int
the inset from the top.
top
,
int
the inset from the left.
left
,
int
the inset from the bottom.
bottom
,
int
the inset from the right.
right
)

Set top, left, bottom, and right to the specified values

public String

Returns:

a string representation of this Insets object.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this Insets object.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

bottomback to summary
public int bottom

The inset from the bottom. This value is subtracted from the Bottom of the rectangle to yield a new location for the Bottom.

See Also
clone()
leftback to summary
public int left

The inset from the left. This value is added to the Left of the rectangle to yield a new location for the Left edge.

See Also
clone()
serialVersionUIDback to summary
private static final long serialVersionUID

Use serialVersionUID from JDK 1.1 for interoperability.

Annotations
@Serial
topback to summary
public int top

The inset from the top. This value is added to the Top of the rectangle to yield a new location for the Top.

See Also
clone()

Constructor Detail

Insetsback to summary
public Insets(int top, int left, int bottom, int right)

Creates and initializes a new Insets object with the specified top, left, bottom, and right insets.

Parameters
top:int

the inset from the top.

left:int

the inset from the left.

bottom:int

the inset from the bottom.

right:int

the inset from the right.

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Create a copy of this object.

Returns:Object

a copy of this Insets object.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Checks whether two insets objects are equal. Two instances of Insets are equal if the four integer values of the fields top, left, bottom, and right are all equal.

Returns:boolean

true if the two insets are equal; otherwise false.

Since
1.1
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code for this Insets.

Returns:int

a hash code for this Insets.

initIDsback to summary
private static native void initIDs()

Initialize JNI field and method IDs

setback to summary
public void set(int top, int left, int bottom, int right)

Set top, left, bottom, and right to the specified values

Parameters
top:int

the inset from the top.

left:int

the inset from the left.

bottom:int

the inset from the bottom.

right:int

the inset from the right.

Since
1.5
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this Insets object. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Returns:String

a string representation of this Insets object.