JAVA setBounds中4个int参数的含义
答案:3 悬赏:60
解决时间 2021-01-04 23:40
- 提问者网友:伴风望海
- 2021-01-04 05:22
JAVA setBounds中4个int参数的含义
最佳答案
- 二级知识专家网友:污到你湿
- 2021-01-04 06:06
setBounds(int x, int y, int width, int height)
前两个是组件左上角在容器中的坐标
后两个是组件的宽度和高度
前两个是组件左上角在容器中的坐标
后两个是组件的宽度和高度
全部回答
- 1楼网友:青灯有味
- 2021-01-04 07:53
前两个是组件左上角的位置,后两个表示组件的长宽。
方法原形是setBounds(int x, int y, int width, int height)。
这是一个重载方法,还有一种形式是setBounds(Rectangle r);
比如:setBounds(new Rectangle(30, 30, 50, 20)),是一样的。
方法原形是setBounds(int x, int y, int width, int height)。
这是一个重载方法,还有一种形式是setBounds(Rectangle r);
比如:setBounds(new Rectangle(30, 30, 50, 20)),是一样的。
- 2楼网友:長槍戰八方
- 2021-01-04 07:13
setBounds
public void setBounds(int x,
int y,
int width,
int height)
移动组件并调整其大小。由 x 和 y 指定左上角的新位置,由 width 和 height 指定新的大小。
参数:
x - 组件的新 x 坐标
y - 组件的新 y 坐标
width - 组件的新 width
height - 组件的新 height
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯