java.awt.geom

Class Dimension2D

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

UNKNOWN: updated to 1.4

Constructor Summary
protected Dimension2D()
The default constructor.
Method Summary
Objectclone()
Create a new dimension of the same run-time type with the same contents as this one.
abstract doublegetHeight()
Get the height of this dimension.
abstract doublegetWidth()
Get the width of this dimension.
abstract voidsetSize(double w, double h)
Set the size of this dimension to the requested values.
voidsetSize(Dimension2D d)
Set the size of this dimension to the requested value.

Constructor Detail

Dimension2D

protected Dimension2D()
The default constructor.

Method Detail

clone

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

Returns: the clone

Throws: OutOfMemoryError If there is not enough memory available.

Since: 1.2

getHeight

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

Returns: the height

getWidth

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

Returns: the width

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