java 如何让子窗口在父窗居中显示
3个回答
展开全部
sub.setLocation(father.getWidth()/2-sub.getWidth()/2, father.getHeight()/2-sub.getHeight()/2);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public void setLocationRelativeTo(Component c)
这个方法看文档貌似可以。
If the component is not null, but it is not
currently showing, the window is placed in the center of
the target screen defined by the GraphicsConfiguration associated with this component.If the component is not null and is shown on
the screen, then the window is located in such a way that
the center of the window coincides with the center of the
component.
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询