java 中 Rectangle 类 的setRect 和setBounds 有什么区别么?试了一下效果一样 那不是多此一举 setRect底层多了这些看不懂int newx,newy,neww,newh;if (x > 2.0 * Integer.MAX_VALUE) {// Too far in positive X direction to represe
来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 22:43:02
java 中 Rectangle 类 的setRect 和setBounds 有什么区别么?试了一下效果一样 那不是多此一举 setRect底层多了这些看不懂int newx,newy,neww,newh;if (x > 2.0 * Integer.MAX_VALUE) {// Too far in positive X direction to represe
java 中 Rectangle 类 的setRect 和setBounds 有什么区别么?
试了一下效果一样 那不是多此一举 setRect底层多了这些看不懂
int newx,newy,neww,newh;
if (x > 2.0 * Integer.MAX_VALUE) {
// Too far in positive X direction to represent...
// We cannot even reach the left side of the specified
// rectangle even with both x & width set to MAX_VALUE.
// The intersection with the "maximal integer rectangle"
// is non-existant so we should use a width < 0.
// REMIND:Should we try to determine a more "meaningful"
// adjusted value for neww than just "-1"?
newx = Integer.MAX_VALUE;
neww = -1;
} else {
newx = clip(x,false);
if (width >= 0) width += x-newx;
neww = clip(width,width >= 0);
}
if (y > 2.0 * Integer.MAX_VALUE) {
// Too far in positive Y direction to represent...
newy = Integer.MAX_VALUE;
newh = -1;
} else {
newy = clip(y,false);
if (height >= 0) height += y-newy;
newh = clip(height,height >= 0);
}
java 中 Rectangle 类 的setRect 和setBounds 有什么区别么?试了一下效果一样 那不是多此一举 setRect底层多了这些看不懂int newx,newy,neww,newh;if (x > 2.0 * Integer.MAX_VALUE) {// Too far in positive X direction to represe
都可以的,你方便用哪个、就用那个