Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Create a single-line text field

import org.eclipse.swt.SWT; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class SingleLinefieldTextExample {   public static void main(String[] args) {     Display display = new Display();     Shell shell = new Shell(display);     shell.setLayout(new GridLayout(1, false));     // Create a single-line text field     new Text(shell, SWT.BORDER);     shell.open();     while (!shell.isDisposed()) {       if (!display.readAndDispatch()) {         display.sleep();       }     }     display.dispose();   } }