Hello java community,
i need again your advices. So i have actionPerformed for my button to check password and username validation. So i also want to count all (Right and wrong) possibility and print on the screen. For example y will try to acces 5 times and one is right. At the end you will show that 4 times was wrong credentials and 1 was right.
thanks!!!!
i need again your advices. So i have actionPerformed for my button to check password and username validation. So i also want to count all (Right and wrong) possibility and print on the screen. For example y will try to acces 5 times and one is right. At the end you will show that 4 times was wrong credentials and 1 was right.
thanks!!!!
Java:
String text = "";
if (password.equals("1111") && name.equals("aaaa")) {
text = "Your Credentials are Right";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#058B2B><b>You have Succesfully Logged IN :)</Center></font>",
"Information Message",
JOptionPane.INFORMATION_MESSAGE);
}
if (password.length() > 3 && name.length() > 8
&& !password.equals("1111")
&& !name.equals("aaaa")) {
text = "Your Credentials are Wrong";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<font color=#FA0808><b> Casual Access</Center></font>",
"Information Message",
JOptionPane.WARNING_MESSAGE);
}
if (password.length() < 3 && name.length() < 8
&& !password.equals("1111")
&& !name.equals("aaaa") && password.length() != 0
&& name.length() != 0) {
text = "Your Credentials are Wrong";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#FA0808><b> Casual Access </Center></font>",
"Information Message",
JOptionPane.WARNING_MESSAGE);
}
if (password.length() == 0 && name.length() == 0) {
text = "Please fill your credentials";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#FA0808><b> Access is denied </Center></font>",
"Information Message",
JOptionPane.ERROR_MESSAGE);
}
if (password.length() == 0 && name.length() > 0
&& !name.equals("aaaa")) {
text = "Password = Null";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#FA0808><b> Casual Access </Center></font>",
"Information Message",
JOptionPane.WARNING_MESSAGE);
}
if (password.length() > 0 && name.length() == 0
&& !password.equals("1111")) {
text = "username is null and password is not right";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#FA0808><b> Casual Access </Center></font>",
"Information Message",
JOptionPane.WARNING_MESSAGE);
}
if (password.equals("1111") && name.length() >= 0
&& password.length() != 0 && !name.equals("aaaa")) {
text = "*******************************";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#FA0808><b> Casual Access </Center></font>",
"Information Message",
JOptionPane.WARNING_MESSAGE);
}
if (password.length() >= 0 && name.equals("aaaa")
&& !password.equals("1111")) {
text = "11111111111111111111111111";
JOptionPane
.showMessageDialog(
new JFrame(),
"<html><Center>"
+ "<Center><font color=#FA0808><b> Casual Access </Center></font>",
"Information Message",
JOptionPane.WARNING_MESSAGE);
}
text += " \n" + "Username:" + name + "\n" + "Password:"
+ password + "\n" + "\n";
fireDetailEvent(new DetailEvent(this, text));
}
});