JAVA setBounds中4个int参数的含义
答案:3 悬赏:10 手机版
解决时间 2021-03-20 02:43
- 提问者网友:暮烟疏雨之际
- 2021-03-19 15:10
JAVA setBounds中4个int参数的含义
最佳答案
- 五星知识达人网友:末日狂欢
- 2021-03-19 15:40
setBounds(int x, int y, int width, int height)
前两个是组件左上角在容器中的坐标
后两个是组件的宽度和高度
前两个是组件左上角在容器中的坐标
后两个是组件的宽度和高度
全部回答
- 1楼网友:由着我着迷
- 2021-03-19 16:11
前两个是组件左上角的位置,后两个表示组件的长宽。
方法原形是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-03-19 16:00
setBounds
public void setBounds(int x,
int y,
int width,
int height)
移动组件并调整其大小。由 x 和 y 指定左上角的新位置,由 width 和 height 指定新的大小。
参数:
x - 组件的新 x 坐标
y - 组件的新 y 坐标
width - 组件的新 width
height - 组件的新 height
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯