Package org.eclipse.swt.graphics

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


        gc.dispose();
        return test;
      }

    }
    gc.dispose();
    // If for some reason we fall through abort
    return textValue;
  }

  /*
 
View Full Code Here


    protected void initializeDialogUnits(Control testControl) {
        // Compute and store a font metric
        GC gc = new GC(testControl);
        gc.setFont(JFaceResources.getDialogFont());
        fontMetrics = gc.getFontMetrics();
        gc.dispose();
    }

    /**
     * Sets the <code>GridData</code> on the specified button to be one that
     * is spaced for the current dialog page units. The method
View Full Code Here

     * 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

    }
    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();
    int charsToClip = Math.round(0.95f*length * (1 - ((float)maxWidth/maxExtent)));
    int pivot = length / 2;
View Full Code Here

      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--;
      end++;
    }
View Full Code Here

        return s;
      }
      start--;
      end++;
    }
    gc.dispose();
    return textValue;
  }

  /**
   * Create a default instance of the blocked handler which does not do
View Full Code Here

  protected void initializeDialogUnits(Control control) {
    // Compute and store a font metric
    GC gc = new GC(control);
    gc.setFont(JFaceResources.getDialogFont());
    fontMetrics = gc.getFontMetrics();
    gc.dispose();
  }

  /**
   * Notifies that the ok button of this dialog has been pressed.
   * <p>
 
View Full Code Here

    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);
    }
    return new Rectangle(extent.x, 0, 1, combo.getSize().y);
View Full Code Here

     * 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

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

  /**
 
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.