Examples of textExtent()


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

    if (textValue == null) {
      return null;
    }
    GC gc = new GC(control);
    int maxWidth = control.getBounds().width - 5;
    int maxExtent = gc.textExtent(textValue).x;
    if (maxExtent < maxWidth) {
      gc.dispose();
      return textValue;
    }
    int length = textValue.length();
View Full Code Here

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

    int end = pivot + (charsToClip/2) + 1;
    while (start >= 0 && end < length) {
      String s1 = textValue.substring(0, start);
      String s2 = textValue.substring(end, length);
      String s = s1 + ELLIPSIS + s2;
      int l = gc.textExtent(s).x;
      if (l < maxWidth) {
        gc.dispose();
        return s;
      }
      start--;
View Full Code Here

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

    Combo combo = (Combo) control;
    int position = combo.getSelection().y;
    String contents = combo.getText();
    GC gc = new GC(combo);
    gc.setFont(combo.getFont());
    Point extent = gc.textExtent(contents.substring(0, Math.min(position,
        contents.length())));
    gc.dispose();
    if (COMPUTE_TEXT_USING_CLIENTAREA) {
      return new Rectangle(combo.getClientArea().x + extent.x, combo
        .getClientArea().y, 1, combo.getClientArea().height);
View Full Code Here

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

    /*
     * Compute the extent of the hover for the current text.
     */
    Point getExtent() {
      GC gc = new GC(hoverShell);
      Point e = gc.textExtent(text);
      gc.dispose();
      e.x += hm * 2;
      e.y += hm * 2;
      return e;
    }
View Full Code Here

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

      GC gc = new GC(list.getTable());
      gc.setFont(list.getTable().getFont());

      int fSeparatorWidth = gc.getAdvanceWidth('-');
      int fMessageLength = gc.textExtent(separatorLabel).x;

      gc.dispose();

      StringBuffer dashes = new StringBuffer();
      int chars = (((width - fMessageLength) / fSeparatorWidth) / 2) - 2;
View Full Code Here

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

  /* (non-Javadoc)
   * @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
   */
  public Point computeSize(int wHint, int hHint, boolean changed) {
        GC gc = new GC(this);
        Point p = gc.textExtent(WorkbenchMessages.HeapStatus_widthStr);
        int height = imgBounds.height;
        // choose the largest of
        //   - Text height + margins
        //  - Image height + margins
        //  - Default Trim heightin
View Full Code Here

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

                String oldText = text.getText();
                String leftText = oldText.substring(0, event.start);
                String rightText = oldText.substring(event.end, oldText.length());
               
                GC gc = new GC(text);
                Point size = gc.textExtent(leftText + event.text + rightText);
                gc.dispose();
               
                if (size.x != 0) {
                    size = text.computeSize(size.x, SWT.DEFAULT);
                }else{
View Full Code Here

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

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

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

        if (multi) {
          //  System.out.println("Multi is true");
            // gd.grabExcessVerticalSpace = true;
            GC gc = new GC(textField);
            try {
                Point extent = gc.textExtent("X");//$NON-NLS-1$
                gd.heightHint = extent.y * 3;
            } finally {
                gc.dispose();
            }
        }
View Full Code Here

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

                @Override
                public void keyReleased( KeyEvent e ) {
                    int numLines = textField.getLineCount();
                    GridData gd = (GridData) textField.getLayoutData();
                    GC gc = new GC(textField);
                    Point extent = gc.textExtent("X");//$NON-NLS-1$
                    if (numLines >= 3) {
                        if ((gd.heightHint / extent.y) > (numLines + 1)) {
                            try {
                                gd.heightHint = extent.y * (numLines--);
                            } finally {
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.