public void setLocationRelativeTo(Component c)
设置窗口相对于指定组件的位置。
如果组件当前未显示或者 c 为 null,则此窗口将置于屏幕的中央。
中点可以使用 GraphicsEnvironment.getCenterPoint 确定。
本文介绍了如何使用Java编程语言中的`setLocationRelativeTo`方法来调整窗口的位置,使其相对于指定的组件居中显示。通过使用`GraphicsEnvironment.getCenterPoint`获取屏幕中心点,可以灵活地控制窗口布局。
public void setLocationRelativeTo(Component c)
设置窗口相对于指定组件的位置。
如果组件当前未显示或者 c 为 null,则此窗口将置于屏幕的中央。
中点可以使用 GraphicsEnvironment.getCenterPoint 确定。
183
961

被折叠的 条评论
为什么被折叠?
