예제 #1
0
 public static void main(String[] args) {
   Display display = Display.getDefault();
   Shell shell = new Shell(display);
   @SuppressWarnings("unused")
   MainWindow inst = new MainWindow(shell, SWT.NULL);
   shell.setLayout(new FillLayout());
   shell.setImage(SWTResourceManager.getImage("images/16x16.png"));
   shell.setText("Change This Title");
   shell.setBackgroundImage(SWTResourceManager.getImage("images/ToolbarBackground.gif"));
   shell.layout();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
 }
예제 #2
0
  /** Open the dialog */
  public QueryOptionsPack open(QueryOptionsPack opt) {
    createContents(opt);

    shell.setLocation(
        getParent().getLocation().x + (getParent().getSize().x / 2) - (shell.getSize().x / 2),
        getParent().getLocation().y + (getParent().getSize().y / 2) - (shell.getSize().y / 2));

    shell.open();

    shell.layout();
    Display display = getParent().getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return opt;
  }