public final class Dimension extends Object
Dimension object.| 构造器 | 说明 |
|---|---|
Dimension(int width,
int height) |
A constructor used to create a
Dimension object with the specified width and height. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
equals(Object obj) |
Checks whether a given object is the same as the current
Dimension object. |
int |
getHeightSize() |
Obtains the height of the current
Dimension object. |
int |
getWidthSize() |
Obtains the width of the current
Dimension object. |
int |
hashCode() |
Obtains the hash code of the current
Dimension object. |
static Dimension |
parseDimension(String dimension) |
Creates a
Dimension object based on a given string. |
String |
toString() |
Obtains the string representation of the current
Dimension object. |
public Dimension(int width,
int height)
Dimension object with the specified width and height.width - Indicates the width of the object.height - Indicates the height of the object.public int getWidthSize()
Dimension object.Dimension object.public int getHeightSize()
Dimension object.Dimension object.public static Dimension parseDimension(String dimension) throws NumberFormatException
Dimension object based on a given string.
The given string consists of two integers (either positive or negative) separated
by an asterisk (*) (ASCII 0x2A) in the format of W*H, for example,
8*10 or -6*-8.
dimension - Indicates the string used to create the Dimension object.Dimension object.NumberFormatException - Throws this exception if the specified string is illegal.NullPointerException - Throws this exception if dimension is null.public int hashCode()
Dimension object.hashCode 在类中 ObjectDimension object.Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public boolean equals(Object obj)
Dimension object.equals 在类中 Objectobj - Indicates the object to be compared with the current Dimension object.true if the two objects are the same; returns false otherwise.Object.hashCode(),
HashMappublic String toString()
Dimension object.
The returned string consists of two integers (either positive or negative) separated by
an asterisk (*) (ASCII 0x2A) in the format of W*H, for example, 8*10
or -6*-8.