Code snippet below includes a class that shows how to use Text class in SWT.

Java Code:
import org.eclipse.swt.widgets.*;
public class SWTText {
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
Text text = new Text (shell, 0);
text.setText ("ASDF");
text.setSize (64, 32);
text.selectAll ();
shell.pack ();
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}