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

The following examples show how to use org.eclipse.swt.widgets.Text#forceFocus() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(5, 5, 5, 5).applyTo(tparent);
	GridDataFactory.fillDefaults().hint(400, 170).grab(true, true).applyTo(tparent);

	if (addOrEditDialog == DIALOG_ADD) {
		new Label(tparent, SWT.None).setText(Messages.getString("dialog.AddOrUpdateNoteDialog.label"));
		cmbRange = new Combo(tparent, SWT.READ_ONLY);
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cmbRange);
		cmbRange.setItems(new String[] { NatTableConstant.CURRENT_TEXT, NatTableConstant.ALL_TEXT });
		cmbRange.select(0);
	}

	Group noteGroup = new Group(tparent, SWT.None);
	noteGroup.setText(Messages.getString("dialog.AddOrUpdateNoteDialog.noteGroup"));
	GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(noteGroup);
	// noteGroup.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
	noteGroup.setLayout(new GridLayout());
	txtNote = new Text(noteGroup, SWT.BORDER | SWT.WRAP | SWT.MULTI);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(txtNote);
	if (addOrEditDialog == DIALOG_EDIT) {
		txtNote.setText(noteItem[3]);
	}
	txtNote.forceFocus();
	return tparent;
}
 
Example 2
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(5, 5, 5, 5).applyTo(tparent);
	GridDataFactory.fillDefaults().hint(400, 170).grab(true, true).applyTo(tparent);

	if (addOrEditDialog == DIALOG_ADD) {
		new Label(tparent, SWT.None).setText(Messages.getString("dialog.AddOrUpdateNoteDialog.label"));
		cmbRange = new Combo(tparent, SWT.READ_ONLY);
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cmbRange);
		cmbRange.setItems(new String[] { NatTableConstant.CURRENT_TEXT, NatTableConstant.ALL_TEXT });
		cmbRange.select(0);
	}

	Group noteGroup = new Group(tparent, SWT.None);
	noteGroup.setText(Messages.getString("dialog.AddOrUpdateNoteDialog.noteGroup"));
	GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(noteGroup);
	// noteGroup.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
	noteGroup.setLayout(new GridLayout());
	txtNote = new Text(noteGroup, SWT.BORDER | SWT.WRAP | SWT.MULTI);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(txtNote);
	if (addOrEditDialog == DIALOG_EDIT) {
		txtNote.setText(noteItem[3]);
	}
	txtNote.forceFocus();
	return tparent;
}