Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.GC.dispose()


    } else {
      // make the comboBox 10 characters wide
      GC gc = new GC(comboBox);
      layoutData.minimumWidth = (gc.getFontMetrics()
          .getAverageCharWidth() * 10) + 10;
      gc.dispose();
    }
    return layoutData;
  }

  /**
 
View Full Code Here


                  .getWidth();
            }

          });
    }
    gc.dispose();
  }

  protected int getTitleAlignment() {
    return SWT.CENTER;
  }
View Full Code Here

        fImage= new Image(parent.getDisplay(), fExtent.x, fExtent.y);
       
        GC gc= new GC(fImage);
        gc.setBackground(fButton.getBackground());
        gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
        gc.dispose();
       
        fButton.setImage(fImage);
        fButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                ColorDialog colorDialog= new ColorDialog(fButton.getShell());
View Full Code Here

            fColor.dispose();
           
        fColor= new Color(display, fColorValue);
        gc.setBackground(fColor);
        gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
        gc.dispose();
       
        fButton.setImage(fImage);
    }
   
    protected Point computeImageSize(Control window) {
View Full Code Here

    protected Point computeImageSize(Control window) {
        GC gc= new GC(window);
        Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
        gc.setFont(f);
        int height= gc.getFontMetrics().getHeight();
        gc.dispose();
        Point p= new Point(height * 3 - 6, height);
        return p;
    }
}
View Full Code Here

    gc.drawImage(collectionImg, srcX, srcY, srcWidth, srcHeight, 0, 0, img.getImageData().width,
        img.getImageData().height);
    Image mask = new Image(Display.getDefault(), img.getBounds());
    img = new Image(Display.getDefault(), img.getImageData(), mask.getImageData());
   
    gc.dispose();
    mask.dispose();
    return img;
  }
}
View Full Code Here

    protected void setPreferredTextSize( int numberOfColumns, int numberOfRows ){
        GC gc = new GC (text);
        FontMetrics fm = gc.getFontMetrics ();
        int width = 30 * fm.getAverageCharWidth ();
        int height = fm.getHeight ();
        gc.dispose();
        text.setSize (text.computeSize (width, height));
    }
    /**
     * Creates an FilterViewer using the provided style.
     * <ul>
 
View Full Code Here

    int spacer = gc.stringExtent(" ").x; //$NON-NLS-1$
    String str = text.getText();
    int textWidth = 50;
    if (str != null && str.length() > 0)
      textWidth = gc.stringExtent(str).x;
    gc.dispose();
    Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
    Point arrowSize = arrow.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
    int borderWidth = getBorderWidth();

    height = Math.max(textSize.y, arrowSize.y);
View Full Code Here

        } finally {
            if (g != null) {
                g.dispose();
            }
            if (gc != null) {
                gc.dispose();
            }
            if (image != null) {
                image.dispose();
            }
        }
View Full Code Here

        widthHint = fm.getAverageCharWidth() * text.length();
      else
        widthHint = fm.getAverageCharWidth() * charWidth;
     
      widthHint += image.getBounds().width + 10;
      gc.dispose();
    }
   
    countLabel.setLayoutData(createStatusLineLayoutData(widthHint, SWT.DEFAULT));
    countLabel.setText(text);
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.