Below is the error i receive after entering correct username and password. How can I correct this? I have 1 textfield for username and password field for password.
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Cannot invoke compareTo(String) on the array type char[]
--------------------------------------
actionlistener:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Cannot invoke compareTo(String) on the array type char[]
--------------------------------------
actionlistener:
public void actionPerformed(ActionEvent e) {
if(e.getSource() == loginButton)
{
if(usernameField.getText().compareTo("Matt") == 0 && passwordField.getPassword().compareTo("password") == 0)
{
JOptionPane.showMessageDialog( null, "Logging in.....");
}
else
{
JOptionPane.showMessageDialog( null, "Incorrect Details, Please check and try again" );
}
}
}