Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.FontMetrics


  }

 
  public static int computeFontHeight(Drawable element) {
    GC gc = new GC(element);
      FontMetrics fm = gc.getFontMetrics ();
      gc.dispose();
      return fm.getHeight();
  }
View Full Code Here


    OwlUI.makeAccessible(fFeedLinkInput, fFeedByLinkButton);
    fFeedLinkInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    GC gc = new GC(fFeedLinkInput);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH);
    gc.dispose();

    ((GridData) fFeedLinkInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links
    fFeedLinkInput.setFocus();
View Full Code Here

      }
    });

    GC gc = new GC(fNameInput);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH);
    gc.dispose();

    ((GridData) fNameInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links
View Full Code Here

        // Create the widget
        fFilterText = new Text(parent, SWT.NONE);
        // Set the font
        final GC gc = new GC(parent);
        gc.setFont(parent.getFont());
        final FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();
        // Create the layout
        final GridData data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 1);
        data.horizontalAlignment = GridData.FILL;
View Full Code Here

        for (int i = 0; i < names.length; ++i) {
            if (i == 0) {
                // Compute and store a font metric
                final GC gc = new GC(tree);
                gc.setFont(tree.getFont());
                final FontMetrics fontMetrics = gc.getFontMetrics();
                gc.dispose();
                columnWidth = Math.max(100, fontMetrics.getAverageCharWidth() * 20);
            }

            // if (columnWidths != null) {
            // final Integer value = columnWidths.getInteger(getFieldId(column
            // .getColumn()));
View Full Code Here

        GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);

        // Compute and store a font metric
        GC gc = new GC(button);
        gc.setFont(button.getFont());
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        int widthHint = org.eclipse.jface.dialogs.Dialog
                .convertVerticalDLUsToPixels(fontMetrics,
                        IDialogConstants.BUTTON_WIDTH);
View Full Code Here

     * @param color the color
     */
    private ImageData createColorImage(Control w, RGB color) {

        GC gc = new GC(w);
        FontMetrics fm = gc.getFontMetrics();
        int size = fm.getAscent();
        gc.dispose();

        int indent = 6;
        int extent = DEFAULT_EXTENT;
        if (w instanceof Table) {
View Full Code Here

     * @param numberOfColumns
     * @param numberOfRows
     */
    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));
    }
View Full Code Here

   
    if (widthHint < 0)
    {
      GC gc = new GC(parent);
      gc.setFont(parent.getFont());
      FontMetrics fm = gc.getFontMetrics();
     
      if (charWidth == -1)
        widthHint = fm.getAverageCharWidth() * text.length();
      else
        widthHint = fm.getAverageCharWidth() * charWidth;
     
      widthHint += image.getBounds().width + 10;
      gc.dispose();
    }
   
View Full Code Here

     */
    public static int getButtonWidth( Control control )
    {
        GC gc = new GC( control );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
        return width;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.FontMetrics

Copyright © 2018 www.massapicom. 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.