Package org.eclipse.swt.widgets

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


      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


        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

      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

        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

        this.nodeFigure = nodeFigure;
    }
   
    public void relocate(CellEditor celleditor) {
        Text text = (Text) celleditor.getControl();
        Point pref = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
        Rectangle rect = this.nodeFigure.getTextBounds();
        text.setBounds(rect.x -1, rect.y -1, pref.x +1, pref.y+1);
    }
}
View Full Code Here

                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);
                }else{
                    size.x = 1;
                }
               
                Control control = getCellEditor().getControl();
View Full Code Here

      public void widgetSelected(SelectionEvent arg0) {
        if(initialConceptsCombo.getText()!=null && !initialConceptsCombo.getText().equals("")){
        final TableItem ti = new TableItem(initialConcepts,SWT.NONE);
        final Text valueTxt = new Text(initialConcepts,SWT.NONE);
        valueTxt.setText(ApplicationResources.getString("SetInitialConcepts.3")); //$NON-NLS-1$
        valueTxt.computeSize(SWT.DEFAULT, initialConcepts.getItemHeight());
        // Set attributes of the editor
        ti.setText(new String []{initialConceptsCombo.getText(),valueTxt.getText()});                    
        }

      }
View Full Code Here

    Text text = (Text) celleditor.getControl();
    Point pref;
    if (text.getText().isEmpty()) {
      pref = new Point(13, 13);
    } else {
      pref = text.computeSize(-1, -1);
    }

    Label label = vertexFigure.getLabelId();
    Rectangle labelBounds = label.getBounds().getCopy();
    label.translateToAbsolute(labelBounds);
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.