Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Create a password text field

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