Examples of textExtent()


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

   */
  private Point getTextDimension(String text) {
    GC gc = new GC(this);
    gc.setFont(JFaceResources.getFontRegistry().getBold(
        JFaceResources.DEFAULT_FONT));
    Point point = gc.textExtent(text);
    point.x++;
    gc.dispose();
    return point;
  }

View Full Code Here

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

        sizeViewer = new ComboExpressionViewer(graphicComposite, SWT.SINGLE);
        sizeViewer.setOptions(getSizeList());
        GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        GC gc = new GC(sizeViewer.getControl());
        try {
            Point extent = gc.textExtent("X");//$NON-NLS-1$
            gd.widthHint = 3 * extent.x;
        } finally {
            gc.dispose();
        }
        sizeViewer.getControl().setLayoutData( gd);
View Full Code Here

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

        if (this.widthInChars != UNLIMITED)
        {
            GC gc = new GC(this.textField);
            try
            {
                Point extent = gc.textExtent("X"); //$NON-NLS-1$
                gd.widthHint = this.widthInChars * extent.x;
            }
            finally
            {
                gc.dispose();
View Full Code Here

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

    try {
      for (int i= 0; i <= last; i++) {
        IRegion line;
        line= doc.getLineInformation(i);
        content= doc.get(line.getOffset(), line.getLength());
        int width= gc.textExtent(content).x;
        if (width > maxWidth) {
          maxWidth= width;
        }
      }
    } catch (BadLocationException e) {
View Full Code Here

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

        int heightHint = 0;
        {
            GC gc = new GC(parent);
            gc.setFont(parent.getFont());
            FontMetrics fm = gc.getFontMetrics();
            Point extent = gc.textExtent("1");
            if(widthHint > 0)
                widthHint = fm.getAverageCharWidth() * widthHint;
            else
                widthHint = extent.x;
            heightHint = fm.getHeight();
View Full Code Here

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

        Point size = super.computeSize(wHint, hHint, changed);
        if (name != null && name.length() > 0) {
            // Need to consider the name of the FormatComposite.
            GC gc = new GC(this);
            Rectangle clientArea = getClientArea();
            Point nameExtent = gc.textExtent(name);
            if (clientArea.width < nameExtent.x + INNER_MARGIN * 2) {
                size.x += INNER_MARGIN * 2 + nameExtent.x - clientArea.width;
            }
            if (clientArea.height < nameExtent.y + INNER_MARGIN * 2) {
                size.y += INNER_MARGIN * 2 + nameExtent.y - clientArea.height;
View Full Code Here

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

        {
          // Use precalculated height
          cellHeight = textHeight;

          // Calculate the text width portion of the cell
          Point dimension = gc.textExtent(item.getText(), DRAW_FLAGS);

          // Always add 1 to ensure that rounding is up and not
          // down
          cellWidth = cellMinWidth + dimension.x + 1;
View Full Code Here

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

    int cellMinLength = HORIZON_MARGIN * 3 + HORIZON_MARGIN/2;
    if (getText() == null) {
      cellLength = cellMinLength;
      if (image != null) cellLength += image.getImageData().width;
    } else if (image == null) {
      cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x;
    } else {
      if ((style & SWT.TOP) == 0 && (style & SWT.BOTTOM) == 0) {
        cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x
        + HORIZON_MARGIN;
        if (image != null) cellLength += image.getImageData().width;
View Full Code Here

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

      if (image != null) cellLength += image.getImageData().width;
    } else if (image == null) {
      cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x;
    } else {
      if ((style & SWT.TOP) == 0 && (style & SWT.BOTTOM) == 0) {
        cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x
        + HORIZON_MARGIN;
        if (image != null) cellLength += image.getImageData().width;
      } else {
        cellLength = gc.textExtent(getText(), DRAW_FLAGS).x;
        if (image != null) {
View Full Code Here

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

      if ((style & SWT.TOP) == 0 && (style & SWT.BOTTOM) == 0) {
        cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x
        + HORIZON_MARGIN;
        if (image != null) cellLength += image.getImageData().width;
      } else {
        cellLength = gc.textExtent(getText(), DRAW_FLAGS).x;
        if (image != null) {
          cellLength = cellLength < image.getImageData().width ? image.getImageData().width : cellLength;
        } else {
          cellLength = cellLength < image.getImageData().width ? image.getImageData().width : cellLength;
        }
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.