java::awt::Dimension Class Reference

Inheritance diagram for java::awt::Dimension:

Inheritance graph
java::awt::Rectanglejava::awt::geom::Dimension2Djava::lang::Object
[legend]
Collaboration diagram for java::awt::Dimension:

Collaboration graph
java::awt::geom::Dimension2Djava::lang::Object
[legend]

List of all members.


Detailed Description

The Dimension class encapsulates the width and height of a component (in integer precision) 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.

Version:
1.31, 01/23/03
Author:
Sami Shaio

Arthur van Hoff

See also:
java.awt.Component

java.awt.LayoutManager

Since:
JDK1.0

Public Member Functions

 Dimension (jint w=0, jint h=0)
 Constructs a new Rectangle whose top-left corner is specified as (xy) and whose width and height are specified by the arguments of the same name.
virtual jdouble getWidth () const
 Returns the width of this dimension in double precision.
virtual jdouble getHeight () const
 Returns the height of this dimension in double precision.
virtual Dimension getSize () const
 Gets the size of this Dimension object.
virtual void setSize (jdouble width, jdouble height)
 Sets the size of this Dimension object to the specified width and height in double precision.
virtual void setSize (const geom::Dimension2D &d)
 Sets the size of this Dimension2D object to match the specified size.
virtual void setSize (const Dimension &d)
 Sets the size of this Dimension object to the specified size.
virtual void setSize (jint width, jint height)
 Sets the size of this Dimension object to the specified width and height.
virtual jboolean equals (const Object &obj) const
 Checks whether two dimension objects have equal values.
virtual jint hashCode () const
 Returns the hash code for this Dimension.
String toString () const
 Returns a string representation of the values of this Dimension object's height and width fields.

Public Attributes

jint width
 The width dimension; negative values can be used.
jint height
 The height dimension; negative values can be used.

Constructor & Destructor Documentation

java::awt::Dimension::Dimension ( jint  w = 0,
jint  h = 0 
)

Constructs a new Rectangle whose top-left corner is specified as (xy) and whose width and height are specified by the arguments of the same name.

Parameters:
x the specified x coordinate
y the specified y coordinate
width the width of the Rectangle
height the height of the Rectangle


Member Function Documentation

virtual jdouble java::awt::Dimension::getWidth (  )  const [virtual]

Returns the width of this dimension in double precision.

Returns:
the width of this dimension in double precision

Implements java::awt::geom::Dimension2D.

Reimplemented in java::awt::Rectangle.

virtual jdouble java::awt::Dimension::getHeight (  )  const [virtual]

Returns the height of this dimension in double precision.

Returns:
the height of this dimension in double precision

Implements java::awt::geom::Dimension2D.

Reimplemented in java::awt::Rectangle.

virtual Dimension java::awt::Dimension::getSize (  )  const [virtual]

Gets the size of this Dimension object.

This method is included for completeness, to parallel the getSize method defined by Component.

Returns:
the size of this dimension, a new instance of Dimension with the same width and height
See also:
java.awt.Dimension::setSize

java.awt.Component::getSize

Since:
JDK1.1

virtual void java::awt::Dimension::setSize ( jdouble  width,
jdouble  height 
) [virtual]

Sets the size of this Dimension object to the specified width and height in double precision.

Note that if width or height are larger than Integer.MAX_VALUE, they will be reset to Integer.MAX_VALUE.

Parameters:
width the new width for the Dimension object
height the new height for the Dimension object

Implements java::awt::geom::Dimension2D.

virtual void java::awt::Dimension::setSize ( const geom::Dimension2D d  )  [virtual]

Sets the size of this Dimension2D object to match the specified size.

This method is included for completeness, to parallel the getSize method of Component.

Parameters:
d the new size for the Dimension2D object

Reimplemented from java::awt::geom::Dimension2D.

virtual void java::awt::Dimension::setSize ( const Dimension d  )  [virtual]

Sets the size of this Dimension object to the specified size.

This method is included for completeness, to parallel the setSize method defined by Component.

Parameters:
d the new size for this Dimension object
See also:
java.awt.Dimension::getSize

java.awt.Component::setSize

Since:
JDK1.1

virtual void java::awt::Dimension::setSize ( jint  width,
jint  height 
) [virtual]

Sets the size of this Dimension object to the specified width and height.

This method is included for completeness, to parallel the setSize method defined by Component.

Parameters:
width the new width for this Dimension object
height the new height for this Dimension object
See also:
java.awt.Dimension::getSize

java.awt.Component::setSize

Since:
JDK1.1

virtual jboolean java::awt::Dimension::equals ( const Object obj  )  const [virtual]

Checks whether two dimension objects have equal values.

Reimplemented from java::lang::Object.

Reimplemented in java::awt::Rectangle.

virtual jint java::awt::Dimension::hashCode (  )  const [virtual]

Returns the hash code for this Dimension.

Returns:
a hash code for this Dimension

Reimplemented from java::lang::Object.

Reimplemented in java::awt::Rectangle.

String java::awt::Dimension::toString (  )  const [virtual]

Returns a string representation of the values of this Dimension object's height and width fields.

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:
a string representation of this Dimension object

Reimplemented from java::lang::Object.

Reimplemented in java::awt::Rectangle.


Member Data Documentation

jint java::awt::Dimension::width

The width dimension; negative values can be used.

See also:
getSize

setSize

jint java::awt::Dimension::height

The height dimension; negative values can be used.

See also:
getSize

setSize


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:55:58 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3