hi Can anyone say me how to use the JpasswordField bcoz i need an application to check the password and login here is my coding but it has a problem it doesnt work. CODE : JPasswordField passwordField=new JPasswordField (25);
if (passwordField!= null) { OkButton.addActionListener(new actionListener() { public void actionPerformed(ActionEvent e) {
char[]input = passwordField.getPassword(); if (isPasswordCorrect(input)) { JOptionPane.showMessageDialog(controllingFrame, "Success! You typed the right password."); } else { JOptionPane.showMessageDialog(controllingFrame, "Invalid password. Try again.", "Error Message", JOptionPane.ERROR_MESSAGE); }
hi if u want to check whether there is text in passwordfield use if(passwordField.getText()!=null) instead of passwordField!=null.
what ur code does is that passwordField!=null checks whether memory is allocated for passwordfield or not. it doesn't check for the emptyness of passwordfield. And it is new A[\b]ctionListener() not new a[\b]ctionListener()
hi if u want to check whether there is text in passwordfield use if(passwordField.getText()!=null) instead of passwordField!=null.
what ur code does is that passwordField!=null checks whether memory is allocated for passwordfield or not. it doesn't check for the emptyness of passwordfield. And it is new A[\b]ctionListener() not new a[\b]ctionListener()
hi if u want to check whether there is text in passwordfield use if(passwordField.getText()!=null) instead of passwordField!=null.
what ur code does is that passwordField!=null checks whether memory is allocated for passwordfield or not. it doesn't check for the emptyness of passwordfield. And it is new A[\b]ctionListener() not new a[\b]ctionListener()