示例#1
0
  public long open(long aLimit) {
    limit = aLimit;
    finalResult = -1L;
    buttonPressed = 0;
    if (sShell == null || sShell.isDisposed()) {
      createSShell();
    }

    sShell.pack();
    Manager.reduceDistance(getParent(), sShell);
    if (lastHexButtonSelected) {
      hexRadioButton.setSelection(true);
    } else {
      decRadioButton.setSelection(true);
    }
    label.setText(
        "Enter location number, 0 to " + limit + " (0x0 to 0x" + Long.toHexString(limit) + ")");
    text.setText(lastLocationText);
    text.selectAll();
    text.setFocus();
    sShell.open();
    Display display = getParent().getDisplay();
    while (!sShell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }

    return finalResult;
  }
示例#2
0
 @Override
 public void run() {
   // use my class for library loading
   try {
     Display display = Display.getDefault();
     final Shell splash = createSplash(display);
     final Shell content = new Shell(display);
     splash.open();
     display.asyncExec(
         new Runnable() {
           @Override
           public void run() {
             runContent(content);
             content.open();
             splash.close();
           }
         });
     while (!splash.isDisposed() || !content.isDisposed()) {
       if (!display.readAndDispatch()) display.sleep();
     }
     if (sandbox != null) sandbox.shutdown();
     display.dispose();
   } catch (Throwable e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     System.err.flush();
     System.out.flush();
     System.exit(0);
   }
 }
示例#3
0
  private void runSession() {
    while (true) {
      shell = arseGUI.open(display);
      initializeARSE();
      while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }

      if (gameMasterMode) {
        gameMasterSession = new GameMasterSession(display);
        gameMasterSession.open();

        gameMasterMode = false;
      } else if (playerMode) {
        playerLoginGUI = new PlayerLoginGUI();
        playerSession = new PlayerSession(display);
        shell = playerLoginGUI.open(display);
        initializePlayerLoginGUI();
        while (!shell.isDisposed()) {
          if (!display.readAndDispatch()) display.sleep();
        }

        if (playerSession.loggedIn()) {
          playerSession.open();
        }
        playerMode = false;
      } else break;
    }
  }
 private void worked() {
   Shell shell = container.getShell();
   Display display = shell.getDisplay();
   if (display != null && !shell.isDisposed()) {
     display.readAndDispatch();
   }
 }
示例#5
0
 /** Subclasses may override to create a shell. */
 protected void createShell() {
   if (shell == null || shell.isDisposed()) {
     shell = new Shell(display, SWT.SHELL_TRIM);
     shell.setLayout(new FillLayout());
     shell.setText("TITLE");
   }
 }
  /**
   * Update the presentation.
   *
   * @param textPresentation the text presentation
   * @param addedPositions the added positions
   * @param removedPositions the removed positions
   */
  private void updatePresentation(
      TextPresentation textPresentation,
      List<Position> addedPositions,
      List<Position> removedPositions) {
    Runnable runnable =
        fJobPresenter.createUpdateRunnable(textPresentation, addedPositions, removedPositions);
    if (runnable == null) {
      return;
    }

    DartEditor editor = fEditor;
    if (editor == null) {
      return;
    }

    IWorkbenchPartSite site = editor.getSite();
    if (site == null) {
      return;
    }

    Shell shell = site.getShell();
    if (shell == null || shell.isDisposed()) {
      return;
    }

    Display display = shell.getDisplay();
    if (display == null || display.isDisposed()) {
      return;
    }

    display.asyncExec(runnable);
  }
示例#7
0
  /**
   * Attempts to restart ADB.
   *
   * <p>If the "ask before restart" setting is set (the default), prompt the user whether now is a
   * good time to restart ADB.
   *
   * @param monitor
   */
  private void askForAdbRestart(ITaskMonitor monitor) {
    final boolean[] canRestart = new boolean[] {true};

    if (getWindowShell() != null
        && getSettingsController().getSettings().getAskBeforeAdbRestart()) {
      // need to ask for permission first
      final Shell shell = getWindowShell();
      if (shell != null && !shell.isDisposed()) {
        shell
            .getDisplay()
            .syncExec(
                new Runnable() {
                  @Override
                  public void run() {
                    if (!shell.isDisposed()) {
                      canRestart[0] =
                          MessageDialog.openQuestion(
                              shell,
                              "ADB Restart",
                              "A package that depends on ADB has been updated. \n"
                                  + "Do you want to restart ADB now?");
                    }
                  }
                });
      }
    }

    if (canRestart[0]) {
      AdbWrapper adb = new AdbWrapper(getOsSdkRoot(), monitor);
      adb.stopAdb();
      adb.startAdb();
    }
  }
示例#8
0
 private boolean showDialog() {
   shell.open();
   while (!shell.isDisposed()) {
     if (!shell.getDisplay().readAndDispatch()) shell.getDisplay().sleep();
   }
   return result;
 }
  /** Open the window */
  public void open() throws Exception {

    final Display display = Display.getDefault();
    createContents();

    _setWndPosition();
    _initXPCOM();
    _initFields();
    _initJSErrorHook();

    m_shell.open();
    m_shell.layout();

    m_shell.addShellListener(
        new ShellAdapter() {

          @Override
          public void shellClosed(ShellEvent e) {
            System.exit(0);
          }
        });

    while (!m_shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
  }
示例#10
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new RowLayout());
   Text text = new Text(shell, SWT.MULTI | SWT.BORDER);
   String modifier = SWT.MOD1 == SWT.CTRL ? "Ctrl" : "Command";
   text.setText("Hit " + modifier + "+Return\nto see\nthe default button\nrun");
   text.addTraverseListener(
       e -> {
         switch (e.detail) {
           case SWT.TRAVERSE_RETURN:
             if ((e.stateMask & SWT.MOD1) != 0) e.doit = true;
         }
       });
   Button button = new Button(shell, SWT.PUSH);
   button.pack();
   button.setText("OK");
   button.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(SelectionEvent e) {
           System.out.println("OK selected");
         }
       });
   shell.setDefaultButton(button);
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
  /** @param args ; */
  public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(1, false));

    final Combo combo = new Combo(shell, SWT.READ_ONLY);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Button button = new Button(shell, SWT.PUSH);
    button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    button.setText("OK");
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            CustomMatchConditionDialog dialog = new CustomMatchConditionDialog(shell);
            int res = dialog.open();
            if (res == CustomMatchConditionDialog.OK) {}
          }
        });

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
  }
  public static void main(final String[] args) {
    final Display display = Display.getDefault();
    final Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    final CompositeTable table = new CompositeTable(shell, SWT.NONE);
    new Header(table, SWT.NONE);
    new Row(table, SWT.NONE);
    table.setRunTime(true);

    final ICompositeTableRidget ridget =
        (ICompositeTableRidget) SwtRidgetFactory.createRidget(table);
    final WritableList input = new WritableList(PersonFactory.createPersonList(), Person.class);
    ridget.bindToModel(input, Person.class, RowRidget.class);
    ridget.updateFromModel();

    shell.setSize(400, 160);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }

    display.dispose();
  }
示例#13
0
  public Main(String args[]) {
    //   must be before display is created (on Macs at least)
    Display.setAppName("BrailleZephyr");

    Display display = Display.getDefault();

    //   needed to catch Quit (Command-Q) on Macs
    display.addListener(SWT.Close, new CloseHandler());

    shell = new Shell(display);
    shell.setLayout(new FillLayout());
    shell.setText("BrailleZephyr");
    shell.addShellListener(new ShellHandler());

    bzStyledText = new BZStyledText(shell);
    bzFile = new BZFile(bzStyledText);
    bzSettings = new BZSettings(bzStyledText);
    new BZMenu(bzStyledText, bzFile, bzSettings);

    //   assume any argument is a file to open
    if (args.length > 0) bzFile.openFile(args[0]);

    shell.open();
    while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();

    display.dispose();
  }
示例#14
0
  private static void main() throws FileNotFoundException {
    // デフォルトDisplayを使用してシェルを作成
    try {
      shell.setSize(100, 100); // シェルのサイズを指定

      // 作成したシェルを使用したLightweightSystemの作成
      LightweightSystem lws = new LightweightSystem(shell);

      // ルート・フィギュアの作成
      IFigure panel = new Figure();
      panel.setLayoutManager(new ToolbarLayout());

      initialize(panel);

      // ルート・フィギュアの登録
      lws.setContents(panel);

      // 以下は、その他のSWTアプリケーションと同様
      shell.open();

      Display display = Display.getDefault();
      while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }

    } finally {
      if (image != null) {
        image.dispose();
      }
    }
  }
  /** @param args */
  public static void main(String[] args) {
    Display display = new Display();
    JFaceResources.getImageRegistry()
        .put(
            "IMG_1",
            ImageDescriptor.createFromURL(
                Snippet033CellEditorPerRowPre33.class
                    .getClassLoader()
                    .getResource("org/eclipse/jface/snippets/dialogs/cancel.png")));
    JFaceResources.getImageRegistry()
        .put(
            "IMG_2",
            ImageDescriptor.createFromURL(
                Snippet033CellEditorPerRowPre33.class
                    .getClassLoader()
                    .getResource("org/eclipse/jface/snippets/dialogs/filesave.png")));
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    new Snippet033CellEditorPerRowPre33(shell);
    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }

    display.dispose();
  }
示例#16
0
  public void run(String trace) throws JDOMException, IOException, JniException {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Flightbox");
    shell.setSize(800, 800);
    shell.setLayout(new FillLayout(SWT.VERTICAL));

    IntervalView widget = new IntervalView(shell, SWT.NONE);
    VersionizedStack<String> stack = new VersionizedStack<String>();
    int i;
    int max = 1000;
    for (i = 0; i < max; i++) {
      long disp = i * 100;
      stack.push("FOO", 10L + disp);
      stack.push("BAR", 20L + disp);
      stack.pop(30L + disp);
      stack.pop(40L + disp);
    }

    widget.setStack(stack);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }

    shell.dispose();
  }
示例#17
0
  public static void main(String[] args) {
    LoggerContext loggerContext = new LoggerContext();
    Display display = new Display();
    ResourceUtil.init(display);
    Shell shell = new Shell(display);
    final Tree tree = new Tree(shell, SWT.BORDER);
    Rectangle clientArea = shell.getClientArea();
    tree.setBounds(clientArea.x, clientArea.y, 200, 200);

    LoggerTree loggerTree = new LoggerTree(loggerContext, tree);
    tree.setMenu(TreeMenuBuilder.buildTreeMenu(loggerTree, null));
    loggerTree.update("com.foo.Bar");
    loggerTree.update("com.foo.Bar");

    loggerContext.getLogger("org.apache.struts").setLevel(Level.ERROR);

    loggerTree.update("org.apache.struts.BlahAction");

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
示例#18
0
  public static void main(String[] args) {
    Display d = new Display();
    Shell shell = new Shell(d);
    shell.setText("GraphSnippet1");
    shell.setLayout(new FillLayout());
    shell.setSize(400, 400);

    final Graph g = new Graph(shell, SWT.NONE);

    hookMenu(g);

    SpaceTreeLayoutAlgorithm spaceTreeLayoutAlgorithm = new SpaceTreeLayoutAlgorithm();
    g.setLayoutAlgorithm(spaceTreeLayoutAlgorithm, false);
    g.setExpandCollapseManager(spaceTreeLayoutAlgorithm.getExpandCollapseManager());

    g.setSubgraphFactory(new DefaultSubgraph.LabelSubgraphFactory());

    for (int i = 0; i < 20; i++) {
      GraphNode graphNode = new GraphNode(g, SWT.NONE);
      graphNode.setText("" + i);
    }

    shell.open();
    while (!shell.isDisposed()) {
      while (!d.readAndDispatch()) {
        d.sleep();
      }
    }
  }
示例#19
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell();

    LightweightSystem lws = new LightweightSystem(shell);

    Figure panel = new Figure();
    panel.setLayoutManager(new FlowLayout());
    panel.setBackgroundColor(ColorConstants.white);

    MouseMotionListener listener =
        new MouseMotionListener.Stub() {
          public void mouseEntered(MouseEvent me) {
            ((Shape) me.getSource()).setBackgroundColor(ColorConstants.yellow);
          }

          public void mouseExited(MouseEvent me) {
            ((Shape) me.getSource()).setBackgroundColor(ColorConstants.white);
          }
        };

    for (int i = 1; i <= 4; i++) {
      Ellipse e = new Ellipse();
      e.setFill(true);
      e.setPreferredSize(new Dimension(20 + 10 * i + i % 2, 60 - 10 * i + i / 2));
      e.addMouseMotionListener(listener);
      panel.add(e);
    }

    lws.setContents(panel);
    shell.setSize(400, 300);
    shell.open();

    while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();
  }
示例#20
0
  public static void view(DrawModel d) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    Composite composite = new Composite(shell, SWT.EMBEDDED | SWT.NO_BACKGROUND);
    Frame baseFrame = SWT_AWT.new_Frame(composite);

    baseFrame.setBounds(0, 0, 800, 600);

    Java3DViewer viewer = new Java3DViewer(baseFrame, d);
    baseFrame.add(viewer);

    shell.open();

    d.setFaceColor(Color.GREEN);
    d.circle(0.9);
    //		viewer.draw(d);

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }

    baseFrame.dispose();
    shell.dispose();
    composite.dispose();
    display.dispose();
    System.exit(0);
  }
示例#21
0
  /**
   * Check if any error occurred during initialization. If it did, display an error message.
   *
   * @return True if an error occurred, false if we should continue.
   */
  public boolean checkIfInitFailed() {
    if (mAvdManagerInitError != null) {
      String example;
      if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS) {
        example = "%USERPROFILE%"; // $NON-NLS-1$
      } else {
        example = "~"; // $NON-NLS-1$
      }

      String error =
          String.format(
              "The AVD manager normally uses the user's profile directory to store "
                  + "AVD files. However it failed to find the default profile directory. "
                  + "\n"
                  + "To fix this, please set the environment variable ANDROID_SDK_HOME to "
                  + "a valid path such as \"%s\".",
              example);

      // We may not have any UI. Only display a dialog if there's a window shell available.
      if (mWindowShell != null && !mWindowShell.isDisposed()) {
        MessageDialog.openError(mWindowShell, "Android Virtual Devices Manager", error);
      } else {
        mSdkLog.error(null /* Throwable */, "%s", error); // $NON-NLS-1$
      }

      return true;
    }
    return false;
  }
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setText("StyledText with underline and strike through");
   shell.setLayout(new FillLayout());
   StyledText text = new StyledText(shell, SWT.BORDER);
   text.setText("0123456789 ABCDEFGHIJKLM NOPQRSTUVWXYZ");
   // make 0123456789 appear underlined
   StyleRange style1 = new StyleRange();
   style1.start = 0;
   style1.length = 10;
   style1.underline = true;
   text.setStyleRange(style1);
   // make ABCDEFGHIJKLM have a strike through
   StyleRange style2 = new StyleRange();
   style2.start = 11;
   style2.length = 13;
   style2.strikeout = true;
   text.setStyleRange(style2);
   // make NOPQRSTUVWXYZ appear underlined and have a strike through
   StyleRange style3 = new StyleRange();
   style3.start = 25;
   style3.length = 13;
   style3.underline = true;
   style3.strikeout = true;
   text.setStyleRange(style3);
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
示例#23
0
  private void notifyToolsNeedsToBeRestarted(int flags) {

    String msg = null;
    if ((flags & TOOLS_MSG_UPDATED_FROM_ADT) != 0) {
      msg =
          "The Android SDK and AVD Manager that you are currently using has been updated. "
              + "Please also run Eclipse > Help > Check for Updates to see if the Android "
              + "plug-in needs to be updated.";

    } else if ((flags & TOOLS_MSG_UPDATED_FROM_SDKMAN) != 0) {
      msg =
          "The Android SDK and AVD Manager that you are currently using has been updated. "
              + "It is recommended that you now close the manager window and re-open it. "
              + "If you use Eclipse, please run Help > Check for Updates to see if the Android "
              + "plug-in needs to be updated.";
    }

    final String msg2 = msg;

    final Shell shell = getWindowShell();
    if (msg2 != null && shell != null && !shell.isDisposed()) {
      shell
          .getDisplay()
          .syncExec(
              new Runnable() {
                @Override
                public void run() {
                  if (!shell.isDisposed()) {
                    MessageDialog.openInformation(shell, "Android Tools Updated", msg2);
                  }
                }
              });
    }
  }
 public static void main(String[] args) {
   final Display display = new Display();
   final Shell shell = new Shell(display);
   shell.setLayout(new FillLayout());
   final StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER);
   styledText.setText(text);
   FontData data = display.getSystemFont().getFontData()[0];
   Font font = new Font(display, data.getName(), 16, SWT.BOLD);
   styledText.setFont(font);
   styledText.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
   styledText.addListener(
       SWT.Resize,
       new Listener() {
         public void handleEvent(Event event) {
           Rectangle rect = styledText.getClientArea();
           Image newImage = new Image(display, 1, Math.max(1, rect.height));
           GC gc = new GC(newImage);
           gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
           gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
           gc.fillGradientRectangle(rect.x, rect.y, 1, rect.height, true);
           gc.dispose();
           styledText.setBackgroundImage(newImage);
           if (oldImage != null) oldImage.dispose();
           oldImage = newImage;
         }
       });
   shell.setSize(700, 400);
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   if (oldImage != null) oldImage.dispose();
   font.dispose();
   display.dispose();
 }
示例#25
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new RowLayout());

    DateTime calendar = new DateTime(shell, SWT.CALENDAR);
    calendar.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println("calendar date changed");
          }
        });

    DateTime time = new DateTime(shell, SWT.TIME);
    time.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println("time changed");
          }
        });

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
示例#26
0
  private void updateShellTitle() {

    if (shell.isDisposed()) return;

    String post = "";

    switch (modeServer) {
      case SERVER_WITH_GAME:
      case SERVER_WITHOUT_GAME:
        post += " [serveur]";
        break;
      case NO_SERVER:
        break;
      default:
        throw new RuntimeException("Not managed :" + modeServer);
    }

    switch (modeClient) {
      case DISCONNECTED:
        post += " [non connecté]";
        break;
      case MONITOR:
        post += " [observation]";
        break;
      case PLAYING:
        post += " [joueur]";
        break;
      default:
        throw new RuntimeException("Not managed :" + modeClient);
    }

    shell.setText(TXT_WINDOW_TITLE + post);
  }
示例#27
0
  /** ********************* CONSTRUCTOR **************************** */
  public RyanairInspector2GUI() {

    bufferNavegadores = new Buffer(new CircularQueue(SIZE));
    for (Navegador n : navegadores) {
      bufferNavegadores.Put(n);
    }

    bufferVuelos = new Buffer(new CircularQueue(SIZE));
    System.out.println(rutaActual);
    System.out.println("-- Empieza lectura fichero --");
    vuelos = UtilsIO.leerFicheroDatosConsultaVuelos(rutaActual + nomFichConsultas);
    for (Vuelo v : vuelos) {
      bufferVuelos.Put(v);
      System.out.println(v.toString());
    }
    System.out.println("-- Termina lectura fichero --");

    /*__ CREAMOS UNA INSTANCIA PARA CAPTURAR UN VUELO */
    unvueloRyanair = new RyanairInspector2();

    creaContenidos();

    // Iniciamos la carga de la pagina
    iniciaCaptura(table);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
    // System.out.println("despues de dispose");

  }
  private void createDialog(Shell applicationShell) {
    if (dialog == null || dialog.isDisposed()) {
      dialog = new Shell(applicationShell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);

      if (applicationShell.getImage() != null) {
        dialog.setImage(applicationShell.getImage());
      }

      dialog.addListener(
          SWT.Close,
          new Listener() {
            public void handleEvent(Event event) {
              hideCustomPanelChildren();
            }
          });

      dialog.addDisposeListener(
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent arg0) {
              disposeImages();
            }
          });

      if (fileDialogMode != VFS_DIALOG_SAVEAS) {
        dialog.setText(Messages.getString("VfsFileChooserDialog.openFile")); // $NON-NLS-1$
      } else {
        dialog.setText(Messages.getString("VfsFileChooserDialog.saveAs")); // $NON-NLS-1$
      }
      dialog.setLayout(new GridLayout());
      dialog.setBackgroundMode(SWT.INHERIT_FORCE);
      dialog.setBackground(dialog.getDisplay().getSystemColor(SWT.COLOR_WHITE));
      createCustomUIPanel(dialog);
    }
  }
示例#29
0
  private void open() {

    display = Display.getDefault();

    shell = new Shell();

    shell.setSize(250, 170);

    // ---------创建窗口中的其他界面组件-------------

    shell.setLayout(new GridLayout());

    createMainComp(shell); // 创建主面板

    createStatusbar(shell); // 创建工具栏
    // -----------------END------------------------

    shell.layout();

    shell.open();

    while (!shell.isDisposed()) {

      if (!display.readAndDispatch()) display.sleep();
    }

    display.dispose();
  }
示例#30
0
 public static void main(java.lang.String[] args) {
   org.eclipse.swt.widgets.Display display = new org.eclipse.swt.widgets.Display();
   org.eclipse.swt.widgets.Shell shell = new org.eclipse.swt.widgets.Shell(display);
   shell.setLayout(new org.eclipse.swt.layout.FillLayout());
   shell.setText(getResourceString("window.title"));
   java.io.InputStream stream =
       (org.eclipse.swt.examples.browserexample.BrowserExample.class)
           .getResourceAsStream(iconLocation);
   org.eclipse.swt.graphics.Image icon = new org.eclipse.swt.graphics.Image(display, stream);
   shell.setImage(icon);
   try {
     stream.close();
   } catch (java.io.IOException e) {
     e.printStackTrace();
   }
   org.eclipse.swt.examples.browserexample.BrowserExample app =
       new org.eclipse.swt.examples.browserexample.BrowserExample(shell, true);
   app.setShellDecoration(icon, true);
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) {
       display.sleep();
     }
   }
   icon.dispose();
   app.dispose();
   display.dispose();
 }