Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Authenticating password and username after jbutton click

$
0
0
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:
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" );
            }

        }
    }

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>