/**
  * Sets the size of the shell to it's "packed" size, unless that makes it larger than the monitor
  * it is being displayed on, in which case just set the shell size to be slightly smaller than the
  * monitor.
  */
 static void setShellSize(ControlExample instance, Shell shell) {
   Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
   Rectangle monitorArea = shell.getMonitor().getClientArea();
   shell.setSize(Math.min(size.x, monitorArea.width), Math.min(size.y, monitorArea.height));
 }