Package org.eclipse.swt.widgets

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


      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

      directEditManager = new TrayCategoryEntryEditPartDirectEditManager(this,
          TextCellEditor.class, new CellEditorLocator() {
            public void relocate(CellEditor celleditor) {
              Text text = (Text) celleditor.getControl();
              Point sel = text.getSelection();
              Point pref = text.computeSize(-1, -1);
              Label label = getDirectEditLabel();
              Rectangle rect = label.getTextBounds().getCopy();
              label.translateToAbsolute(rect);
              text.setBounds(rect.x - 4, rect.y - 1, pref.x + 1, pref.y + 1);
              text.setSelection(0);
View Full Code Here

        setLabel(label);
    }

    public void relocate(CellEditor cellEditor) {
        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

      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

      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

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.