|
|
|
@ -298,7 +298,11 @@ public final class GUICoreUtils {
|
|
|
|
|
* @param win the current window august:现在要考虑左边日志模板的影响 |
|
|
|
|
*/ |
|
|
|
|
public static void centerWindow(Window win) { |
|
|
|
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
|
|
|
|
// Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小
|
|
|
|
|
// getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标
|
|
|
|
|
Rectangle rectangle = win.getGraphicsConfiguration().getBounds(); |
|
|
|
|
|
|
|
|
|
Dimension screenSize = rectangle.getSize(); |
|
|
|
|
|
|
|
|
|
Dimension winSize = win.getSize(); |
|
|
|
|
|
|
|
|
@ -308,7 +312,7 @@ public final class GUICoreUtils {
|
|
|
|
|
if (winSize.width > screenSize.width) { |
|
|
|
|
winSize.width = screenSize.width; |
|
|
|
|
} |
|
|
|
|
win.setLocation((screenSize.width - winSize.width) / 2, (screenSize.height - winSize.height) / 2 - WINDOW_GAP); |
|
|
|
|
win.setLocation(rectangle.x + (screenSize.width - winSize.width) / 2, rectangle.y + (screenSize.height - winSize.height) / 2 - WINDOW_GAP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|