This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JPassowrldField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JPassowrldField" Watch "JPassowrldField" New topic
Author

JPassowrldField

Larry Lai
Ranch Hand

Joined: May 13, 2002
Posts: 44
Hi everyone,
How're you ?

Do you know how to make the password in the JPasswordField getting the actionperform
then matching that "Javaranch" is the password
then if it's "Javaranch", log on.
Thanks..
Larry
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
String password = new String(passwordTextField.getPassword()).trim();
if (password.equals(someStoredPassword)) {
//allow login
} else {
//invalid password
}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JPassowrldField