All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.Dimension
Dimension
class encapsulates the width and
height of a component in a single object. The class is
associated with certain properties of components. Several methods
defined by the Component
class and the
LayoutManager
interface return a
Dimension
object.
Normally the values of width
and height
are non-negative integers.
The constructors that allow you to create a dimension do
not prevent you from setting a negative value for these properties.
If the value of width
or height
is
negative, the behavior of some methods defined by other objects is
undefined.
Dimension
with a width
of zero and a height of zero.
Dimension
whose width
and height are the same as for the specified dimension.
Dimension
object.
Dimension
object to the specified size.
Dimension
object
to the specified width and height.
Dimension
object's values.
public int width
public int height
public Dimension()
Dimension
with a width
of zero and a height of zero.
public Dimension(Dimension d)
Dimension
whose width
and height are the same as for the specified dimension.
width
and
height
values.
public Dimension(int width, int height)
public Dimension getSize()
Dimension
object.
This method is included for completeness, to parallel the
getSize
method defined by Component
.
Dimension
with the same width and height.
public void setSize(Dimension d)
Dimension
object to the specified size.
This method is included for completeness, to parallel the
setSize
method defined by Component
.
Dimension
object.
public void setSize(int width, int height)
Dimension
object
to the specified width and height.
This method is included for completeness, to parallel the
setSize
method defined by Component
.
Dimension
object.
Dimension
object.
public boolean equals(Object obj)
public String toString()
Dimension
object's values.
width
and height
.
All Packages Class Hierarchy This Package Previous Next Index