Package org.eclipse.swt.graphics

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


      if (image != null) cellLength += image.getImageData().width;
    } else if (image == null) {
      cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x*2;
    } else {
      if ((style & SWT.TOP) == 0 && (style & SWT.BOTTOM) == 0) {
        cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x* 2 + HORIZON_MARGIN;
        if (image != null) cellLength += image.getImageData().width;
      } else {
        cellLength = gc.textExtent(getText(), DRAW_FLAGS).x * 2;
        if (image != null) {
          cellLength = cellLength < image.getImageData().width ? image.getImageData().width : cellLength;
View Full Code Here


    } else {
      if ((style & SWT.TOP) == 0 && (style & SWT.BOTTOM) == 0) {
        cellLength = cellMinLength + gc.textExtent(getText(), DRAW_FLAGS).x* 2 + HORIZON_MARGIN;
        if (image != null) cellLength += image.getImageData().width;
      } else {
        cellLength = gc.textExtent(getText(), DRAW_FLAGS).x * 2;
        if (image != null) {
          cellLength = cellLength < image.getImageData().width ? image.getImageData().width : cellLength;
        } else {
          cellLength = cellLength < image.getImageData().width ? image.getImageData().width : cellLength;
        }
View Full Code Here

      tabHeight = fixedTabHeight == 0 ? 0 : fixedTabHeight + 1; // +1 for line drawn across top of tab
    } else {
      int tempHeight = 0;
      GC gc = new GC(this);
      if (items.length == 0) {
        tempHeight = gc.textExtent("Default", CTabItem.FLAGS).y + CTabItem.TOP_MARGIN + CTabItem.BOTTOM_MARGIN; //$NON-NLS-1$
      } else {
        for (int i=0; i < items.length; i++) {
          tempHeight = Math.max(tempHeight, items[i].preferredHeight(gc));
        }
      }
View Full Code Here

  }

  private void setWidthForSampleText(Text control, String sampleText) {
    GC gc = new GC(control);
    try {
      Point sampleSize = gc.textExtent(sampleText);
      Point currentSize = control.getSize();
      sampleSize.y = currentSize.y;
      control.setSize(sampleSize);
      return;
    } finally {
View Full Code Here

  }

  private void setWidthForSampleText(Text control, String sampleText) {
    GC gc = new GC(control);
    try {
      Point sampleSize = gc.textExtent(sampleText);
      Point currentSize = control.getSize();
      sampleSize.y = currentSize.y;
      control.setSize(sampleSize);
      return;
    } finally {
View Full Code Here

  }

  private void setWidthForSampleText(Text control, String sampleText) {
    GC gc = new GC(control);
    try {
      Point sampleSize = gc.textExtent(sampleText);
      Point currentSize = control.getSize();
      sampleSize.y = currentSize.y;
      control.setSize(sampleSize);
      return;
    } finally {
View Full Code Here

        gc.setForeground(colorFg2);
        Font font = new Font(null, "Arial", 10, SWT.BOLD);
        gc.setFont(font);
        gc.drawText("Ol�, " + system.getLogged().getName(),           
            componentsAreaComposite.getBounds().width - 130
            - gc.textExtent("Ol�, "
                + system.getLogged().getName()).x, 10,
                SWT.DRAW_TRANSPARENT);

        gc.setForeground(colorBg2);
        Color colorBg3 = new Color(null, 255, 255, 255);
View Full Code Here

                gc.drawLine(0, 2, footer.getClientArea().width, 2);
                gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));

                String balanceValueFormated = new Money(balanceValue).getFormatedValue();
               
                Point endBalance = gc.textExtent("Balan�o final: R$ " + balanceValueFormated);
                gc.drawText("Balan�o final: R$ " + balanceValueFormated, footer.getClientArea().width - 10 - endBalance.x, 10, SWT.DRAW_TRANSPARENT);
                gc.dispose();
            }
        });
View Full Code Here

      int width = 0;
      int colCount = weeksVisible ? 8 : 7;
      int linesCount = colCount + 1;
      String[] months = df1.getDateFormatSymbols().getMonths();
      for (int i = 0; i < months.length; i++) {
        width = Math.max(width, gc.textExtent(months[i]).x);
      }
      width += prevMonth.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed).x * 2
       + HEADER_SPACING * 4 + gc.textExtent(" 9999").x; //$NON-NLS-1$
      width = Math.max(width, (gc.textExtent("99").x + theme.cellPadding * 2)
                               * colCount + linesCount); //$NON-NLS-1$
View Full Code Here

      String[] months = df1.getDateFormatSymbols().getMonths();
      for (int i = 0; i < months.length; i++) {
        width = Math.max(width, gc.textExtent(months[i]).x);
      }
      width += prevMonth.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed).x * 2
       + HEADER_SPACING * 4 + gc.textExtent(" 9999").x; //$NON-NLS-1$
      width = Math.max(width, (gc.textExtent("99").x + theme.cellPadding * 2)
                               * colCount + linesCount); //$NON-NLS-1$
      int cw = (width - linesCount) / colCount + 1;
      width = cw * colCount + linesCount;
      ((GridData) monthHeader.getLayoutData()).widthHint = width;
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.