示例#1
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();
 }
示例#2
0
 public void freeResources() {
   for (int i = 0; i < tools.length; ++i) {
     org.eclipse.swt.examples.paint.Tool tool = tools[i];
     final org.eclipse.swt.graphics.Image image = tool.image;
     if (image != null) {
       image.dispose();
     }
     tool.image = null;
   }
 }
示例#3
0
 void freeResources() {
   if (images != null) {
     for (int i = 0; i < images.length; ++i) {
       final org.eclipse.swt.graphics.Image image = images[i];
       if (image != null) {
         image.dispose();
       }
     }
     images = null;
   }
 }