java.awt
Class Dimension

java.lang.Object
  |
  +--java.awt.geom.Dimension2D
        |
        +--java.awt.Dimension
All Implemented Interfaces:
Cloneable, Serializable

public class Dimension
extends java.awt.geom.Dimension2D
implements Serializable

Safe:

See Also:
Serialized Form

Field Summary
 int height
          Suppressed: The height dimension; negative values can be used.
private static long serialVersionUID
           
 int width
          Suppressed: The width dimension; negative values can be used.
 
Constructor Summary
Dimension()
          Enabled: Creates an instance of Dimension with a width of zero and a height of zero.
Dimension(Dimension d)
          Suppressed: Creates an instance of Dimension whose width and height are the same as for the specified dimension.
Dimension(int width, int height)
          Enabled: Constructs a Dimension and initializes it to the specified width and specified height.
 
Method Summary
 boolean equals(Object obj)
          Suppressed: Checks whether two dimension objects have equal values.
 double getHeight()
          Enabled: Returns the height of this dimension in double precision.
 Dimension getSize()
          Enabled: Gets the size of this Dimension object.
 double getWidth()
          Enabled: Returns the width of this dimension in double precision.
 int hashCode()
          Suppressed: Returns the hash code for this Dimension.
private static void initIDs()
          Initialize JNI field and method IDs
 void setSize(Dimension d)
          Suppressed: Sets the size of this Dimension object to the specified size.
 void setSize(double width, double height)
          Enabled: Sets the size of this Dimension object to the specified width and height in double precision.
 void setSize(int width, int height)
          Enabled: Sets the size of this Dimension object to the specified width and height.
 String toString()
          Suppressed: Returns a string representation of the values of this Dimension object's height and width fields.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public int width
Suppressed: The width dimension; negative values can be used.

See Also:
getSize(), setSize(double, double)

height

public int height
Suppressed: The height dimension; negative values can be used.

See Also:
getSize(), setSize(double, double)

serialVersionUID

private static final long serialVersionUID
Constructor Detail

Dimension

public Dimension()
Enabled: Creates an instance of Dimension with a width of zero and a height of zero.


Dimension

public Dimension(Dimension d)
Suppressed: Creates an instance of Dimension whose width and height are the same as for the specified dimension.

Parameters:
d - the specified dimension for the width and height values

Dimension

public Dimension(int width,
                 int height)
Enabled: Constructs a Dimension and initializes it to the specified width and specified height.

Parameters:
width - the specified width
height - the specified height
Method Detail

initIDs

private static void initIDs()
Initialize JNI field and method IDs


getWidth

public double getWidth()
Enabled: Returns the width of this dimension in double precision.

Overrides:
getWidth in class java.awt.geom.Dimension2D
Returns:
the width of this dimension in double precision

getHeight

public double getHeight()
Enabled: Returns the height of this dimension in double precision.

Overrides:
getHeight in class java.awt.geom.Dimension2D
Returns:
the height of this dimension in double precision

setSize

public void setSize(double width,
                    double height)
Enabled: 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.

Overrides:
setSize in class java.awt.geom.Dimension2D
Parameters:
width - the new width for the Dimension object
height - the new height for the Dimension object

getSize

public Dimension getSize()
Enabled: 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
Since:
JDK1.1
See Also:
java.awt.Dimension#setSize, java.awt.Component#getSize

setSize

public void setSize(Dimension d)
Suppressed: 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
Since:
JDK1.1
See Also:
java.awt.Dimension#getSize, java.awt.Component#setSize

setSize

public void setSize(int width,
                    int height)
Enabled: 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
Since:
JDK1.1
See Also:
java.awt.Dimension#getSize, java.awt.Component#setSize

equals

public boolean equals(Object obj)
Suppressed: Checks whether two dimension objects have equal values.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode(), java.util.Hashtable

hashCode

public int hashCode()
Suppressed: Returns the hash code for this Dimension.

Overrides:
hashCode in class Object
Returns:
a hash code for this Dimension
See Also:
java.lang.Object#equals(java.lang.Object), java.util.Hashtable

toString

public String toString()
Suppressed: 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.

Overrides:
toString in class Object
Returns:
a string representation of this Dimension object


comments?