Hey Guys, Im currently learning Java and my teacher has asked me to make a Password Checker. Like ones on forums when you register. So it asks you to type your password and then you gotta retype. Im supposed to make it make sure its not empty, Make sure they are the same, and make sure it uses atleast 8 characters. Im having some problems with the comparing and the limations on the characters. Think somebody can help me?
Code:
private void btnSubmitMouseClicked(java.awt.event.MouseEvent evt) {
int Password;
if(pwPassword.getPassword.isEmpty()){
JOptionPane.showMessageDialog(mainPanel,"Error: Please Enter Your Password.","Error Message", JOptionPane.ERROR_MESSAGE);
}
else if(pwPassword.getPassword().equals(pwPasswordRe.getPassword())){
JOptionPane.showMessageDialog(mainPanel,"Success: Passwords were Successfully entered","Success Message", JOptionPane.INFORMATION_MESSAGE);
}
When I have That above, It errors.
Why does it error like that?
I cannot figure out how to Make sure they have typed atleast 8 characters either, anyone care to help me out with that part?
Hey Guys, Im currently learning Java and my teacher has asked me to make a Password Checker. Like ones on forums when you register. So it asks you to type your password and then you gotta retype. Im supposed to make it make sure its not empty, Make sure they are the same, and make sure it uses atleast 8 characters. Im having some problems with the comparing and the limations on the characters. Think somebody can help me?
Code:
private void btnSubmitMouseClicked(java.awt.event.MouseEvent evt) {
int Password;
if(pwPassword.getPassword.isEmpty()){
JOptionPane.showMessageDialog(mainPanel,"Error: Please Enter Your Password.","Error Message", JOptionPane.ERROR_MESSAGE);
}
else if(pwPassword.getPassword().equals(pwPasswordRe.getPassword())){
JOptionPane.showMessageDialog(mainPanel,"Success: Passwords were Successfully entered","Success Message", JOptionPane.INFORMATION_MESSAGE);
}
When I have That above, It errors.
Why does it error like that?
I cannot figure out how to Make sure they have typed atleast 8 characters either, anyone care to help me out with that part?
I am in Java class as well
What errors are you getting?
tells me like, stuff like .equals() and .isEmpty() is not compatible with .getPassword() or something like that. Im using NetBeans.
Originally Posted by Decieved-
tells me like, stuff like .equals() and .isEmpty() is not compatible with .getPassword() or something like that. Im using NetBeans.
Add me on MSN (fk127@live.com), and I will be able to help better