Method from java.awt.Dimension Detail: |
public boolean equals(Object obj) {
if (obj instanceof Dimension) {
Dimension d = (Dimension)obj;
return (width == d.width) && (height == d.height);
}
return false;
}
Checks whether two dimension objects have equal values. |
public double getHeight() {
return height;
}
|
public Dimension getSize() {
return new Dimension(width, height);
}
Gets the size of this Dimension object.
This method is included for completeness, to parallel the
getSize method defined by Component . |
public double getWidth() {
return width;
}
|
public int hashCode() {
int sum = width + height;
return sum * (sum + 1)/2 + width;
}
Returns the hash code for this Dimension . |
public void setSize(Dimension d) {
setSize(d.width, d.height);
}
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 . |
public void setSize(double width,
double height) {
this.width = (int) Math.ceil(width);
this.height = (int) Math.ceil(height);
}
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 . |
public void setSize(int width,
int height) {
this.width = width;
this.height = height;
}
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 . |
public String toString() {
return getClass().getName() + "[width=" + width + ",height=" + height + "]";
}
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 . |