Eclipse Draw2d
2.1

org.eclipse.draw2d.geometry
Class Insets

java.lang.Object
  |
  +--org.eclipse.draw2d.geometry.Insets
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
IFigure.NoInsets

public class Insets
extends Object
implements Cloneable, Serializable

Stores four integers for top, left, bottom, and right measurements.

See Also:
Serialized Form

Field Summary
 int bottom
          distance from bottom
 int left
          distance from left
 int right
          distance from right
 int top
          distance from top
 
Constructor Summary
Insets()
          Constructs an Insets with all zeroes.
Insets(Insets i)
          Constructs a new Insets with initial values the same as the provided Insets.
Insets(int i)
          Constructs a new Insets with all the sides set to the speicifed value.
Insets(int top, int left, int bottom, int right)
          Creates a new Insets with the specified top, left, bottom, and right values.
 
Method Summary
 Insets add(Insets insets)
          Adds the values of the specified Insets to this Insets' values.
 boolean equals(Object o)
          Test for equality.
 Insets getAdded(Insets insets)
          Creates an Insets representing the sum of this Insets with the specified Insets.
 int getHeight()
          Returns the height for this Insets, equal to top + bottom.
 Insets getTransposed()
          Creates a new Insets with transposed values.
 int getWidth()
          Returns the width for this Insets, equal to left + right.
 boolean isEmpty()
          Returns true if all values are 0.
 String toString()
           
 Insets transpose()
          Transposes this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

left

public int left
distance from left


top

public int top
distance from top


bottom

public int bottom
distance from bottom


right

public int right
distance from right

Constructor Detail

Insets

public Insets()
Constructs an Insets with all zeroes.

Since:
2.0

Insets

public Insets(Insets i)
Constructs a new Insets with initial values the same as the provided Insets.

Parameters:
i - The insets to copy.
Since:
2.0

Insets

public Insets(int i)
Constructs a new Insets with all the sides set to the speicifed value.

Parameters:
i - Value applied to all sides of new Insets.
Since:
2.0

Insets

public Insets(int top,
              int left,
              int bottom,
              int right)
Creates a new Insets with the specified top, left, bottom, and right values.

Parameters:
top - Value of the top space.
left - Value of the left space.
bottom - Value of the bottom space.
right - Value of the right space.
Since:
2.0
Method Detail

add

public Insets add(Insets insets)
Adds the values of the specified Insets to this Insets' values.

Parameters:
insets - the Insets being added
Returns:
this for convenience
Since:
2.0

equals

public boolean equals(Object o)
Test for equality. The Insets are equal if their top, left, bottom, and right values are equivalent.

Overrides:
equals in class Object
Parameters:
o - Object being tested for equality.
Returns:
true if all values are the same.
Since:
2.0

getAdded

public Insets getAdded(Insets insets)
Creates an Insets representing the sum of this Insets with the specified Insets.

Parameters:
insets - Insets to be added
Returns:
A new Insets
Since:
2.0

getHeight

public int getHeight()
Returns the height for this Insets, equal to top + bottom.

Returns:
The sum of top + bottom
Since:
2.0
See Also:
getWidth()

getTransposed

public Insets getTransposed()
Creates a new Insets with transposed values. Top and Left are transposed. Bottom and Right are transposed.

Returns:
New Insets with the transposed values.
Since:
2.0

getWidth

public int getWidth()
Returns the width for this Insets, equal to left + right.

Returns:
The sum of left + right
Since:
2.0
See Also:
getHeight()

isEmpty

public boolean isEmpty()
Returns true if all values are 0.

Returns:
true if all values are 0
Since:
2.0

toString

public String toString()
Overrides:
toString in class Object
Returns:
String representation.
Since:
2.0

transpose

public Insets transpose()
Transposes this object. Top and Left are exchanged. Bottom and Right are exchanged. Can be used in orientation changes.

Returns:
this for convenience
Since:
2.0

Eclipse Draw2d
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.