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

The following are Jave code examples for showing how to use setBounds() 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.
+ Save this method
Example 1
Project: gw4e.project   File: VertextCellEditorLocator.java   View Source Code 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   View Source Code 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);
}
 
Example 3
Project: Hydrograph   File: TextGridRowBuilder.java   View Source Code Vote up 5 votes
public Composite addHeader(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(false);
			text.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(false);
			text.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
			text.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));				
		}
		

		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 4
Project: Hydrograph   File: TextGridRowBuilder.java   View Source Code Vote up 5 votes
public Composite addRaw(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	rowSelection.setEnabled(enabled);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}
		
		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 5
Project: Hydrograph   File: ELTSWTWidgets.java   View Source Code Vote up 5 votes
public Text textBoxWidget(Composite parent, int style, int[] bounds,
		String text, boolean value) {
	Text textWidget = new Text(parent, style);
	textWidget.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	textWidget.setText(text);
	textWidget.setEditable(value);

	return textWidget;
}
 
Example 6
Project: Hydrograph   File: ELTLookupConfigGrid.java   View Source Code Vote up 5 votes
public Text textBoxWidget(Composite parent, int[] bounds, String textValue, boolean value) {
	Text text = new Text(parent, SWT.BORDER | SWT.READ_ONLY | SWT.LEFT);
	text.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	text.setText(textValue);
	text.setEditable(value);

	return text;
}
 
Example 7
Project: Hydrograph   File: CommentBoxCellEditorLocator.java   View Source Code Vote up 5 votes
@Override
public void relocate(CellEditor celleditor) {
	Text text = (Text)celleditor.getControl();
	Rectangle rect = comment.getClientArea();
	comment.translateToAbsolute(rect);
	org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
	rect.translate(trim.x, trim.y);
	rect.width += trim.width;
	rect.height += trim.height;
	//text.setBounds(rect.x, rect.y, rect.width, rect.height);
	
	text.setBounds(rect.x - 5, rect.y - 8, rect.width+10, rect.height+16);
}
 
Example 8
Project: bdf2   File: NodeCellEditorLocator.java   View Source Code Vote up 4 votes
@Override
public void relocate(CellEditor celleditor) {
	Text text=(Text)celleditor.getControl();
	text.setBounds(node.getX(), node.getY(),node.getWidth(), node.getHeight());
}