PasswordDialog.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.remote.ui;
00002 
00003 import org.eclipse.jface.dialogs.Dialog;
00004 import org.eclipse.jface.dialogs.IInputValidator;
00005 import org.eclipse.jface.dialogs.InputDialog;
00006 import org.eclipse.swt.SWT;
00007 import org.eclipse.swt.widgets.Display;
00008 import org.eclipse.swt.widgets.Shell;
00009 
00010 /***************************************************************
00011  * 
00012  * A simple password prompt dialog
00013  * @see org.eclipse.jface.dialogs.InputDialog
00014  *
00015  ***************************************************************/
00016 public class PasswordDialog extends InputDialog 
00017 {
00018 
00019     public PasswordDialog(Shell parentShell, String dialogTitle,
00020             String dialogMessage, String initialValue, IInputValidator validator) {
00021 
00022         super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
00023     }
00024 
00025     
00026     @Override
00027     protected int getInputTextStyle() {
00028         return super.getInputTextStyle() | SWT.PASSWORD;
00029     }
00030     
00031     
00035     public static void main(String[] args) {
00036         
00037         Display display = new Display();
00038         Shell shell = display.getActiveShell();
00039         
00040         PasswordDialog dlg = new PasswordDialog(shell, "Password", "Your password", null, null);
00041         
00042         if (dlg.open() == Dialog.OK) {
00043             System.out.println("valud: " + dlg.getValue());
00044         }
00045     }
00046 
00047 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1