height
のゲッターとwidth
メンバーがreturn
タイプを持っているのを見て驚いてdouble
いますint
。さらに、setSize
doubleパラメーターを使用するメソッドには、次の定義があります。
/**
* Sets the size of this <code>Dimension</code> object to
* the specified width and height in double precision.
* Note that if <code>width</code> or <code>height</code>
* are larger than <code>Integer.MAX_VALUE</code>, they will
* be reset to <code>Integer.MAX_VALUE</code>.
*
* @param width the new width for the <code>Dimension</code> object
* @param height the new height for the <code>Dimension</code> object
*/
public void setSize(double width, double height) {
this.width = (int) Math.ceil(width);
this.height = (int) Math.ceil(height);
}
Dimensionクラスをご覧ください。上記のコメントは、値がInteger.MAX_VALUEを超えることはできないことを示しています。なんで?なぜdouble
間にあるのですか?微妙な理由はありますか?誰かが私にこれを説明できますか?私の主張でごめんなさい!