Design a Password Prompter
1 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Friday, August 2, 2002 05:29 PM

I am wanting a small frame to appear when the application starts up, prompting the user for a password. Can anyone offer any suggestions as to how this could be best done. This feature will be enabled by the user on one of the screens of the application and the correct password will be stored by the user in a jpasswordfield after they have installed the product.

Hope u can help,

Re: Design a Password Prompter

Posted By:   George_Tzallas  
Posted On:   Monday, August 5, 2002 02:00 AM

There should be many elaborate ways to achieve what you want.

Since you want this feature to be enabled/disabled you should keep a file that contains
application properties (something like prompt_on_startup -> true/false).
On startup you read this file, and if this property is

  1. true, then display a JDialog, containing a JTextField and a JPasswordField prompting
    for a user name and a password, respectively. How you store/retrieve this password is up to you;
    you could hard-code it, use file system/network, use a database (going from easiest, cheapest to
    more sophisticated, harder, expensive). After verifying the password you should show your
  2. false, just show your JFrame

This is an outline of a solution, I am not including coding details.

You could check your JDK installation (under demo/jfc/TableExample) for an example on how
to display a dialog, validate a username/password and then show your main application.

Best regards

George Tzallas

About | Sitemap | Contact