java中如何调整jpane的大小和位置?jframe的大小不变的情况下。
1个回答
展开全部
JPanel吧?JPanel是透明的,一般不固定大小和位置,而是用布局管理器。
如果想强制大小和位置的话,就把父容器的布局管理器设为null,用
public void setBounds(int x,int y,int width,int height)
//Moves and resizes this component. The new location of the top-left corner is specified by x //and y, and the new size is specified by width and height.
public void setLocation(Point p)
//Moves this component to a new location. The top-left corner of the new location is specified //by point p. Point p is given in the parent's coordinate space.
public void setSize(int width,int height)
//Resizes this component so that it has width width and height height.
如果想强制大小和位置的话,就把父容器的布局管理器设为null,用
public void setBounds(int x,int y,int width,int height)
//Moves and resizes this component. The new location of the top-left corner is specified by x //and y, and the new size is specified by width and height.
public void setLocation(Point p)
//Moves this component to a new location. The top-left corner of the new location is specified //by point p. Point p is given in the parent's coordinate space.
public void setSize(int width,int height)
//Resizes this component so that it has width width and height height.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询