• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

automatic Jdialog box authentication

hello there,

i have a java web start application which displays a username/password dialog box wqhen the application runs.now i want to add a feature so that users can save the username password by clciking on a checkbox.so that when they next time start the application the program will start with out users to enter those details.can anybody provide some guide how to acheive this.

cheers
zolf
0
zolf
Asked:
zolf
  • 5
1 Solution
 
zzynxSoftware engineerCommented:
>> i want to add a feature so that users can save the username password
>> by clciking on a checkbox.
First, I don't think it's a good idea to save the password (security)
To save the user name use the Preferences class:
http://www.exampledepot.com/egs/java.util.prefs/GetSet.html
0
 
zzynxSoftware engineerCommented:
So, when clicking the check box, you save the username ( Preferences.put() )
When starting next time you check if a saved username is available (Preferences.get()) and if it is, you fill that one in the user name box.

Saving: userPref.put("username", theUserName);

Checking: String tmp = userPref.get("username", null);
                 if (tmp!=null) {
                      // Use it
                 }
0
 
zzynxSoftware engineerCommented:
btw, on a Windows machine this info is saved in the registry.

Where?

If you use this:
Preferences userPref =  
       Preferences.userNodeForPackage(com.mycompany.MyClass.class);
then

userPref.put("username", theUserName);

leads to an entry
HKCU\Software\JavaSoft\Prefs\com\mycompany\username
0
 
zzynxSoftware engineerCommented:
0
 
zzynxSoftware engineerCommented:
Thanx 4 axxepting
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now