|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.graphics.GDimension
public class GDimension
This class is a double-precision version of the Dimension
class
in java.awt
.
Constructor Summary | |
---|---|
GDimension()
Constructs a new dimension object with zero values for width and height. |
|
GDimension(Dimension size)
Constructs a new GDimension object from an AWT Dimension . |
|
GDimension(double width,
double height)
Constructs a new dimension object with the specified components. |
|
GDimension(GDimension size)
Constructs a new GDimension object from an existing one. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Tests whether two GDimension objects are equal. |
double |
getHeight()
Returns the height of this GDimension . |
GDimension |
getSize()
Returns a new GDimension object equal to this one. |
double |
getWidth()
Returns the width of this GDimension . |
int |
hashCode()
Returns an integer hash code for the dimension object. |
void |
setSize(double width,
double height)
Sets the components of the dimension object from the specified parameters. |
void |
setSize(GDimension size)
Sets the width and height of one GDimension object equal to that of another. |
Dimension |
toDimension()
Converts this GDimension to the nearest integer-based
Dimension . |
String |
toString()
Converts this GDimension to its string representation. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GDimension()
public GDimension(Dimension size)
GDimension
object from an AWT Dimension
.
size
- An AWT Dimension
object specifying the sizepublic GDimension(double width, double height)
width
- The width of the dimension objectheight
- The height of the dimension objectpublic GDimension(GDimension size)
GDimension
object from an existing one.
size
- An existing GDimension
object specifying the sizeMethod Detail |
---|
public boolean equals(Object obj)
GDimension
objects are equal.
Because floating-point values are inexact, this method checks for
equality by comparing the float
values (rather than the
double
values) of the coordinates.
equals
in class Object
obj
- Any object
true
if the obj
is a GDimension
equal to this one, and false
otherwisepublic double getHeight()
GDimension
.
GDimension
public GDimension getSize()
GDimension
object equal to this one.
GDimension
object with the same sizepublic double getWidth()
GDimension
.
GDimension
public int hashCode()
GDimension
is constructed from the hash codes from the
float
values of the width and height, which are the ones used in the
equals
method.
hashCode
in class Object
public void setSize(double width, double height)
width
- The new width of the dimension objectheight
- The new height of the dimension objectpublic void setSize(GDimension size)
GDimension
object equal to that of another.
size
- A GDimension
object specifying the new sizepublic Dimension toDimension()
GDimension
to the nearest integer-based
Dimension
.
Dimension
objectpublic String toString()
GDimension
to its string representation.
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |