setBounds()的作用?

天天45932022-10-04 11:39:541条回答

已提交,审核后显示!提交回复

共1条回复
maonv118 共回答了24个问题 | 采纳率91.7%
setBounds(x,y,width,height); x:组件在容器X轴上的起点 y:组件在容器Y轴上的起点 width:组件的长度 height:组件的
1年前

相关推荐

setBounds(i,i>99?99:i,90,30)中i>99?99:i是如何理解的
lishanpp1年前1
lyly_lee 共回答了22个问题 | 采纳率68.2%
i>99?99:i
这个是说当i大于99时,取99
其它情况,取i
java 中 Rectangle 类 的setRect 和setBounds 有什么区别么?
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);
}
sd2367684541年前1
fiostar 共回答了14个问题 | 采纳率92.9%
都可以的,你方便用哪个、就用那个