watch the video for the designing part!
write the following code inside the click event of the button:
Declare following variable inside the class but outside the click event of the button as:
int attemtp=1;
String user = txtuser.getText();
String pass = txtpass.getText();
if(attempt <4 && user.equals("TSN") && pass.equals("TSN")){
JOptionPane.showMessageDialog(null, "accessed!");
}
else if(attempt!=4){
JOptionPane.showMessageDialog(null, "denied"+attempt);
}
else
{
JOptionPane.showMessageDialog(null, "attempt exceed!"+attempt);
txtuser.setEditable(false);
txtpass.setEnabled(false);
}
if(attempt==5){
this.dispose();
}
attempt++;
}
write the following code inside the click event of the button:
Declare following variable inside the class but outside the click event of the button as:
int attemtp=1;
String user = txtuser.getText();
String pass = txtpass.getText();
if(attempt <4 && user.equals("TSN") && pass.equals("TSN")){
JOptionPane.showMessageDialog(null, "accessed!");
}
else if(attempt!=4){
JOptionPane.showMessageDialog(null, "denied"+attempt);
}
else
{
JOptionPane.showMessageDialog(null, "attempt exceed!"+attempt);
txtuser.setEditable(false);
txtpass.setEnabled(false);
}
if(attempt==5){
this.dispose();
}
attempt++;
}
iam doing a mini project i created a login page like in this video
ReplyDeletecan i add more to it like new window for administrator and user
the project is employee management system
i am just a beginner
please help me
thank you