Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 void initResources() {
   final java.lang.Class clazz = this.getClass();
   if (resourceBundle != null) {
     try {
       if (images == null) {
         images = new org.eclipse.swt.graphics.Image[imageLocations.length];
         for (int i = 0; i < imageLocations.length; ++i) {
           java.io.InputStream sourceStream = clazz.getResourceAsStream(imageLocations[i]);
           org.eclipse.swt.graphics.ImageData source =
               new org.eclipse.swt.graphics.ImageData(sourceStream);
           org.eclipse.swt.graphics.ImageData mask = source.getTransparencyMask();
           images[i] = new org.eclipse.swt.graphics.Image(null, source, mask);
           try {
             sourceStream.close();
           } catch (java.io.IOException e) {
             e.printStackTrace();
           }
         }
       }
       return;
     } catch (java.lang.Throwable t) {
     }
   }
   java.lang.String error =
       resourceBundle != null
           ? getResourceString("error.CouldNotLoadResources")
           : "Unable to load resources";
   freeResources();
   throw new java.lang.RuntimeException(error);
 }