Package org.eclipse.swt.graphics

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


        int max= (int) (Math.ceil(maxItem * (maxItem < 0 ? 0.8 : 1.2)));
        int min= (int) (Math.floor(minItem * (minItem < 0 ? 1.2 : 0.8)));

        String smin= this.fDimension.getDisplayValue(min);
        Point emin= g.stringExtent(smin);

        String smax= this.fDimension.getDisplayValue(max);
        Point emax= g.stringExtent(smax);

        int labelWidth= Math.max(emin.x, emax.x) + 2;
View Full Code Here


        String smin= this.fDimension.getDisplayValue(min);
        Point emin= g.stringExtent(smin);

        String smax= this.fDimension.getDisplayValue(max);
        Point emax= g.stringExtent(smax);

        int labelWidth= Math.max(emin.x, emax.x) + 2;

        int top= PADDING;
        int bottom= bounds.height - titleHeight - PADDING;
View Full Code Here

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

        if (text != null && text.length() > 0) {
            GC gc = new GC(this);
            Point extent = gc.stringExtent(text);
            gc.dispose();
            width += extent.x;
            height = Math.max(height, extent.y);
        }
View Full Code Here

  @Test
  public void styledText_hasMonospaceFont() {
    ConfigEditor editor = new ConfigEditor( shell );

    GC gc = new GC( editor.getControl() );
    assertEquals( gc.stringExtent( "i" ), gc.stringExtent( "m" ) );
  }

  @Test
  public void setEnabled_setsEditableAndForeground() {
    ConfigEditor editor = new ConfigEditor( shell );
View Full Code Here

  @Test
  public void styledText_hasMonospaceFont() {
    ConfigEditor editor = new ConfigEditor( shell );

    GC gc = new GC( editor.getControl() );
    assertEquals( gc.stringExtent( "i" ), gc.stringExtent( "m" ) );
  }

  @Test
  public void setEnabled_setsEditableAndForeground() {
    ConfigEditor editor = new ConfigEditor( shell );
View Full Code Here

    checkWidget ();
    int width = 0, height = 0;
    String[] items = getStringsFromTable();
    int textWidth = 0;
    GC gc = new GC (text);
    int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
    for (int i = 0; i < items.length; i++) {
        textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
    }
    gc.dispose();
    Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
View Full Code Here

    String[] items = getStringsFromTable();
    int textWidth = 0;
    GC gc = new GC (text);
    int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
    for (int i = 0; i < items.length; i++) {
        textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
    }
    gc.dispose();
    Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
    Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
    Point listSize = table.computeSize (wHint, SWT.DEFAULT, changed);
View Full Code Here

        public Point computeSize(int wHint, int hHint, boolean changed)
        {
            String text = series.getLabel();

            GC gc = new GC(this);
            Point extentText = gc.stringExtent(text);
            gc.dispose();

            return new Point(extentText.x + extentText.y + 12, extentText.y + 2);
        }
    }
View Full Code Here

            String info = getInfo();

            GC gc = e.gc;
            gc.setForeground(Colors.getTextColor(gc.getBackground()));
            gc.drawString(text, 2, 2, true);
            Point extent = gc.stringExtent(text);
            gc.drawString(info, 2, extent.y + 1, true);

            e.gc.setForeground(oldForeground);
            e.gc.setBackground(oldBackground);
        }
View Full Code Here

        {
            String text = item.getName();
            String info = getInfo();

            GC gc = new GC(this);
            Point extentText = gc.stringExtent(text);
            Point extentInfo = gc.stringExtent(info);
            gc.dispose();

            return new Point(Math.max(extentText.x, extentInfo.x) + 4, extentText.y + extentInfo.y + 4);
        }
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.