Examples of stringExtent()


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

  public Point computeSize(int wHint, int hHint, boolean changed) {
    checkWidget();
    int width = 0, height = 0;

    GC gc = new GC(text);
    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();
View Full Code Here

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

    GC gc = new GC(text);
    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();
View Full Code Here

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

      fIndentation= new int[fCachedNumberOfDigits + 1];

      char[] nines= new char[fCachedNumberOfDigits];
      Arrays.fill(nines, '9');
      String nineString= new String(nines);
      Point p= gc.stringExtent(nineString);
      fIndentation[0]= p.x;

      for (int i= 1; i <= fCachedNumberOfDigits; i++) {
        p= gc.stringExtent(nineString.substring(0, i));
        fIndentation[i]= fIndentation[0] - p.x;
View Full Code Here

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

      String nineString= new String(nines);
      Point p= gc.stringExtent(nineString);
      fIndentation[0]= p.x;

      for (int i= 1; i <= fCachedNumberOfDigits; i++) {
        p= gc.stringExtent(nineString.substring(0, i));
        fIndentation[i]= fIndentation[0] - p.x;
      }

    } finally {
      gc.dispose();
View Full Code Here

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

      // paint the nodes
      for (Iterator iter = entities.iterator(); iter.hasNext();) {
        SimpleNode entity = (SimpleNode) iter.next();

        String name = entity.toString();
        Point textSize = gcBuffer.stringExtent(name);
        int entityX = (int) entity.getX();
        int entityY = (int) entity.getY();
        //TODO: What about resize from the layout algorithm
        int entityWidth = Math.max((int) entity.getWidth(), textSize.x + 8);
        int entityHeight = Math.max((int) entity.getHeight(), textSize.y + 2);
View Full Code Here

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

  private Caret createOverwriteCaret(StyledText styledText) {
    Caret caret= new Caret(styledText, SWT.NULL);
    GC gc= new GC(styledText);
    // XXX this overwrite box is not proportional-font aware
    // take 'a' as a medium sized character
    Point charSize= gc.stringExtent("a"); //$NON-NLS-1$
   
    // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612
    caret.setSize(charSize.x, styledText.getLineHeight());
    caret.setFont(styledText.getFont());
   
View Full Code Here

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

    Image image = new Image(Display.getCurrent(), imageData);
    GC gc = new GC(image);

    String styleString = style.getStyle().name().substring(0, 2);
    Point p = gc.stringExtent(styleString);

    gc.dispose();
    image.dispose();

    imageData = new ImageData(p.x + 4, p.y, 1, paletteData);
View Full Code Here

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

    GC gc = new GC(_shell);

    String lines[] = _text.split("\n");
    Point longest = null;
    int typicalHeight = gc.stringExtent("X").y;

    for (String line : lines) {
      Point extent = gc.stringExtent(line);
      if (longest == null) {
        longest = extent;
View Full Code Here

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

    String lines[] = _text.split("\n");
    Point longest = null;
    int typicalHeight = gc.stringExtent("X").y;

    for (String line : lines) {
      Point extent = gc.stringExtent(line);
      if (longest == null) {
        longest = extent;
        continue;
      }
View Full Code Here

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

    GC gc = new GC(_shell);

    String lines[] = _text.split("\n");
    Point longest = null;
    int typicalHeight = gc.stringExtent("X").y;

    for (String line : lines) {
      Point extent = gc.stringExtent(line);
      if (longest == null) {
        longest = extent;
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.