早教吧作业答案频道 -->其他-->
java中Rectangle类的setRect和setBounds有什么区别么?试了一下效果一样那不是多此一举setRect底层多了这些看不懂intnewx,newy,neww,newh;if(x>2.0*Integer.MAXVALUE){//ToofarinpositiveXdirectiontoreprese
题目详情
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);
}
试了一下效果一样 那不是多此一举 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类...的网友还看了以下:
如果一个直角三角形两条直角边分别长5厘米和3厘米.(1)以长边为轴旋转一周所得圆锥的底面直径是多少 2020-05-12 …
谁是对牛弹琴?A是一个想离婚而没离成的男人A:男人心里其实太弱啊B:人本来有脆弱的一面A:都有啊A 2020-06-11 …
A种果汁比B种果汁贵1元,小斌同学要了3杯B果汁,2杯A果汁,花了16元,A,B果汁分别多少元解出 2020-07-22 …
∫1/((x-a)(x-b))dx=(ln|x-a|-ln|x-b|)/(a-b)+C如果((x- 2020-07-29 …
判断对错如果一个分数比它的倒数小,它一定是个真分数.()如果a与b互为倒数,则a与b成反比例.() 2020-07-30 …
A、B、C、D四人完成一件工作,D做了一天因事请假,结果A做了6天,B做了5天,C做了4天,D作为 2020-07-30 …
解关于X的方程(b+x)/a+2=(x-a)/b如果按方法(x-a)/b-(b+x)/a=2(ax- 2020-11-01 …
1.少先队参加植树劳动,每人植树2棵,如果一个人挖一个树坑需要25分钟,运树苗一趟(最多可运4棵)需 2020-11-10 …
以下叙述正确的一项是()A.果胶酶是催化果胶分解,从而提高水果出汁率并使果汁变得澄清的一种酶B.一个 2020-11-28 …
Description:给定两头大象的体重A,B(1≤A,B≤1000),请判断他们谁比较重.Inp 2020-12-05 …