java.awt.geom
Class Dimension2D

java.lang.Object
  extended by java.awt.geom.Dimension2D
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Dimension

public abstract class Dimension2D
extends Object
implements Cloneable

This stores a dimension in 2-dimensional space - a width (along the x-axis) and height (along the y-axis). The storage is left to subclasses.

Since:
1.2

Constructor Summary
protected Dimension2D()
          The default constructor.
 
Method Summary
 Object clone()
          Create a new dimension of the same run-time type with the same contents as this one.
abstract  double getHeight()
          Get the height of this dimension.
abstract  double getWidth()
          Get the width of this dimension.
 void setSize(Dimension2D d)
          Set the size of this dimension to the requested value.
abstract  void setSize(double w, double h)
          Set the size of this dimension to the requested values.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dimension2D

protected Dimension2D()
The default constructor.

Method Detail

getWidth

public abstract double getWidth()
Get the width of this dimension. A negative result, while legal, is undefined in meaning.

Returns:
the width

getHeight

public abstract double getHeight()
Get the height of this dimension. A negative result, while legal, is undefined in meaning.

Returns:
the height

setSize

public abstract void setSize(double w,
                             double h)
Set the size of this dimension to the requested values. Loss of precision may occur.

Parameters:
w - the new width
h - the new height

setSize

public void setSize(Dimension2D d)
Set the size of this dimension to the requested value. Loss of precision may occur.

Parameters:
d - the dimension containing the new values
Throws:
NullPointerException - if d is null

clone

public Object clone()
Create a new dimension of the same run-time type with the same contents as this one.

Overrides:
clone in class Object
Returns:
the clone
Throws:
OutOfMemoryError - If there is not enough memory available.
Since:
1.2
See Also:
Cloneable