Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Text.computeSize()


      Rectangle rect = getLabel().getTextBounds().getCopy();
      getLabel().translateToAbsolute(rect);
      if (!text.getFont().isDisposed()) {
        int avr = FigureUtilities.getFontMetrics(text.getFont())
            .getAverageCharWidth();
        rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
            SWT.DEFAULT)).expand(avr * 2, 0));
      }
      if (!rect.equals(new Rectangle(text.getBounds()))) {
        text.setBounds(rect.x, rect.y, rect.width, rect.height);
      }
View Full Code Here


      Rectangle rect = getWrapLabel().getTextBounds().getCopy();
      getWrapLabel().translateToAbsolute(rect);
      if (!text.getFont().isDisposed()) {
        if (getWrapLabel().isTextWrapOn()
            && getWrapLabel().getText().length() > 0) {
          rect.setSize(new Dimension(text.computeSize(rect.width,
              SWT.DEFAULT)));
        } else {
          int avr = FigureUtilities.getFontMetrics(text.getFont())
              .getAverageCharWidth();
          rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
View Full Code Here

          rect.setSize(new Dimension(text.computeSize(rect.width,
              SWT.DEFAULT)));
        } else {
          int avr = FigureUtilities.getFontMetrics(text.getFont())
              .getAverageCharWidth();
          rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
              SWT.DEFAULT)).expand(avr * 2, 0));
        }
      }
      if (!rect.equals(new Rectangle(text.getBounds()))) {
        text.setBounds(rect.x, rect.y, rect.width, rect.height);
View Full Code Here

      Rectangle rect = getLabel().getTextBounds().getCopy();
      getLabel().translateToAbsolute(rect);
      if (!text.getFont().isDisposed()) {
        int avr = FigureUtilities.getFontMetrics(text.getFont())
            .getAverageCharWidth();
        rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
            SWT.DEFAULT)).expand(avr * 2, 0));
      }
      if (!rect.equals(new Rectangle(text.getBounds()))) {
        text.setBounds(rect.x, rect.y, rect.width, rect.height);
      }
View Full Code Here

    if (exposeRegion.width > 0 && exposeRegion.height > 0) {
      source.getViewer().reveal(source);
    }
   
    Text text = (Text) celleditor.getControl();
    Point pref = text.computeSize(-1, -1);
    Rectangle rect = label.getTextBounds().getCopy();
    label.translateToAbsolute(rect);
    text.setBounds(rect.x - 1, rect.y - 1, pref.x + 1, pref.y + 1);
  }
View Full Code Here

            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);
          getCellEditor().getControl().setSize(size.x, size.y);
        }
      }
    };
    text.addVerifyListener(verifyListener);
View Full Code Here

    // zoom
    labelRect.width = (int) (labelRect.width * zoom);
    labelRect.height = (int) (labelRect.height * zoom);
   
    Text text = (Text) celleditor.getControl();
    Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
       
    if (text.getText().length() == 0) {
      textSize.x = 10;
    }
    Point size = new Point(Math.min(textSize.x, labelRect.width), Math.min(textSize.y, labelRect.height));
View Full Code Here

    if (!vertical) {
      Text text = new Text(coolBar, SWT.BORDER | SWT.SINGLE);
      textItem = new CoolItem(coolBar, itemStyle);
      textItem.setControl(text);
      textItem.addSelectionListener(new CoolItemSelectionListener());
      Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
      textSize = textItem.computeSize(textSize.x, textSize.y);
      textItem.setMinimumSize(textSize);
      textItem.setPreferredSize(textSize);
      textItem.setSize(textSize);
    }
View Full Code Here

      final GC gc = new GC(t);
      final FontMetrics fm = gc.getFontMetrics();
      final int width = chars * fm.getAverageCharWidth();
      final int height = fm.getHeight();
      gc.dispose();
      t.setSize(t.computeSize(width, height));
      t.addListener(SWT.DefaultSelection, this);
      t.addListener(SWT.Modify, this);

    }

View Full Code Here

      Text text = (Text) celleditor.getControl();
      Rectangle rect = getWrapLabel().getTextBounds().getCopy();
      getWrapLabel().translateToAbsolute(rect);
      if (getWrapLabel().isTextWrapOn()
          && getWrapLabel().getText().length() > 0) {
        rect.setSize(new Dimension(text.computeSize(rect.width,
            SWT.DEFAULT)));
      } else {
        int avr = FigureUtilities.getFontMetrics(text.getFont())
            .getAverageCharWidth();
        rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT,
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.