public org.eclipse.swt.widgets.Shell open(org.eclipse.swt.widgets.Display display) { createShell(display); createMenuBar(); createStyledText(); shell.setSize(500, 400); shell.open(); return shell; }
private static void setShellSize( org.eclipse.swt.widgets.Display display, org.eclipse.swt.widgets.Shell shell) { org.eclipse.swt.graphics.Rectangle bounds = display.getBounds(); org.eclipse.swt.graphics.Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); if (size.x > bounds.width) { size.x = bounds.width * 9 / 10; } if (size.y > bounds.height) { size.y = bounds.height * 9 / 10; } shell.setSize(size); }