Cek Login Pada Java



public boolean cekpassword()
{
String username = "coba" ;
String pass = "123";
String userinput = tfUser.getText();
String userpass = tfPassword.getText();

if(userinput.equals(username)&&userpass.equals(pass)){
JOptionPane.showMessageDialog(null,"Welcome To My Program") ;
Menu mn=new Menu();
mn.setVisible(true);

}

else{
GAGAL = GAGAL + 1 ;
JOptionPane.showMessageDialog(this, "Anda GAGAL,Silahkan Mencoba Kembali : " + GAGAL ,"Informasi",JOptionPane.WARNING_MESSAGE);
if ( GAGAL == 5 )
{
System.exit(0);
}

}
return false ;
}
}


sumber : http://ketutmardika.blogspot.com/

1 comments:

Post a Comment