java.awt
public class Dimension extends Dimension2D implements Serializable
It is valid for a dimension to have negative width or height; but it is considered to have no area. Therefore, the behavior in various methods is undefined in such a case.
There are some public fields; if you mess with them in an inconsistent manner, it is your own fault when you get invalid results. Also, this class is not threadsafe.
Since: 1.0
See Also: Component LayoutManager
UNKNOWN: updated to 1.14
Field Summary | |
---|---|
int | height
The height of this object.
|
int | width
The width of this object.
|
Constructor Summary | |
---|---|
Dimension()
Create a new Dimension with a width and height of zero. | |
Dimension(Dimension d)
Create a new Dimension with width and height identical to that of the
specified dimension.
| |
Dimension(int w, int h)
Create a new Dimension with the specified width and height.
|
Method Summary | |
---|---|
boolean | equals(Object obj)
Tests this object for equality against the specified object. |
double | getHeight()
Gets the height of this dimension.
|
Dimension | getSize()
Returns the size of this dimension. |
double | getWidth()
Gets the width of this dimension.
|
int | hashCode()
Return the hashcode for this object. |
void | setSize(double w, double h)
Sets the size of this dimension. |
void | setSize(Dimension d)
Sets the width and height of this object to match that of the
specified object.
|
void | setSize(int w, int h)
Sets the width and height of this object to the specified values.
|
String | toString()
Returns a string representation of this object. |
Parameters: d the Dimension to copy
Throws: NullPointerException if d is null
Parameters: w the width of this object h the height of this object
Parameters: obj the object to test against
Returns: true if the object is equal to this
Returns: the height, as a double
Returns: a copy of this dimension
Since: 1.1
See Also: setSize
Returns: the width, as a double
((width + height) * (width + height + 1) / 2) + width
.
Returns: the hashcode
Parameters: w the new width h the new height
Since: 1.2
Parameters: d the Dimension to get the new width and height from
Throws: NullPointerException if d is null
Since: 1.1
See Also: getSize
Parameters: w the new width value h the new height value
getClass().getName() + "[width=" + width + ",height=" + height
+ ']'
.
Returns: a string representation of this object