Package org.eclipse.swt.widgets

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


        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


      Text text = (Text) celleditor.getControl();
      Rectangle rect = getLabel().getTextBounds().getCopy();
      getLabel().translateToAbsolute(rect);
      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

        String rightText = oldText.substring(event.end, 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

  /**
   * @see CellEditorLocator#relocate(org.eclipse.jface.viewers.CellEditor)
   */
  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

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.