Java Code Examples for org.eclipse.swt.widgets.Text.computeSize()

The following are Jave code examples for showing how to use computeSize() of the org.eclipse.swt.widgets.Text class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gw4e.project   File: VertextCellEditorLocator.java   Source Code and License Vote up 6 votes
@Override
public void relocate(CellEditor celleditor) {
	Text text = (Text) celleditor.getControl();
	Point pref = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	Rectangle rect = nameLabel.getTextBounds().getCopy();
	nameLabel.translateToAbsolute(rect);
	text.setBounds(rect.x - 1, rect.y - 1, pref.x + 1, pref.y + 1);
}
 
Example 2
Project: gw4e.project   File: EdgeCellEditorLocator.java   Source Code and License Vote up 5 votes
@Override
public void relocate(CellEditor celleditor) {
	Text text = (Text) celleditor.getControl();
	Point pref = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	Rectangle rect = nameLabel.getTextBounds().getCopy();
	nameLabel.translateToAbsolute(rect);
	text.setBounds(rect.x - 1, rect.y - 1, pref.x + 1, pref.y + 1);
}