public static void setLocationCenter(JFrame frame) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension compSize = frame.getSize();
if (compSize.height > screenSize.height) {
compSize.height = screenSize.height;
}
if (compSize.width > screenSize.width) {
compSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - compSize.width) / 2,
(screenSize.height - compSize.height) / 2);
}
swing显示屏幕中间方法
最新推荐文章于 2022-11-04 10:51:01 发布