Updated initial window sizing

master
Marco Maccaferri 2018-12-20 10:04:11 +01:00
rodzic 0c5a4cb4f9
commit 743022b9cc
1 zmienionych plików z 16 dodań i 13 usunięć

Wyświetl plik

@ -143,19 +143,6 @@ public class Application {
createHelpMenu(menu);
shell.setMenuBar(menu);
Rectangle screen = display.getClientArea();
Rectangle rect = new Rectangle(0, 0, (int) ((float) screen.width / (float) screen.height * 800), 850);
rect.x = (screen.width - rect.width) / 2;
rect.y = (screen.height - rect.height) / 2;
if (rect.y < 0) {
rect.height += rect.y * 2;
rect.y = 0;
}
shell.setLocation(rect.x, rect.y);
shell.setSize(rect.width, rect.height);
GridLayout layout = new GridLayout(1, false);
layout.marginWidth = layout.marginHeight = 5;
shell.setLayout(layout);
@ -169,6 +156,22 @@ public class Application {
statusLine = new StatusLine(shell);
statusLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Rectangle screen = display.getClientArea();
Rectangle rect = new Rectangle(0, 0, (int) ((float) screen.width / (float) screen.height * 800), 900);
rect.x = (screen.width - rect.width) / 2;
rect.y = (screen.height - rect.height) / 2;
if (rect.y < 0) {
rect.height += rect.y * 2;
rect.y = 0;
}
shell.setLocation(rect.x, rect.y);
shell.setSize(rect.width, rect.height);
if (rect.width > screen.width || rect.height > screen.height) {
shell.setMaximized(true);
}
shell.open();
shell.addListener(SWT.Close, new Listener() {