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