Results 1 to 1 of 1
Thread: How to get password in SWT
-
How to get password in SWT
Java Code:import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class UserPassword { Display display = new Display(); Shell shell = new Shell(display); Text textUser; Text textPassword; private void init() { (new Label(shell, SWT.NULL)).setText("User name: "); textUser = new Text(shell, SWT.SINGLE | SWT.BORDER); textUser.setText("default_user"); textUser.setTextLimit(16); (new Label(shell, SWT.NULL)).setText("Password: "); textPassword = new Text(shell, SWT.SINGLE | SWT.BORDER); System.out.println(textPassword.getEchoChar()); textPassword.setEchoChar('*'); } public UserPassword() { shell.setLayout(new GridLayout(2, false)); init(); textUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); textPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.pack(); shell.open(); //textUser.forceFocus(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); } public static void main(String[] args) { new UserPassword(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
password ?!
By jon80 in forum New To JavaReplies: 9Last Post: 11-14-2008, 01:19 PM -
Password System help
By quickfingers in forum New To JavaReplies: 1Last Post: 06-23-2008, 06:18 PM -
Password class help
By buzzdsm in forum New To JavaReplies: 3Last Post: 06-23-2008, 06:00 PM -
Asking for password from a Servlet
By Java Tip in forum Java TipReplies: 0Last Post: 01-27-2008, 08:05 PM -
add password to folder
By ismailsaleh in forum AWT / SwingReplies: 1Last Post: 01-08-2008, 05:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks