This question already has an answer here:
- Error: 'else' without 'if' 4 answers
I have this error on else. Can anyone help me?
I'm trying to make a Login system.
JButton btnLogin = new JButton("Login");
btnLogin.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String password = txtPasswort.getText();
String username = txtName.getText();
if(password.contains("you wont see the pass lol") && username.contains("Splxsh"));
if(password.contains("you wont see the pass lol") && username.contains("zCode"));
txtPasswort.setText(null);
txtName.setText(null);
JOptionPane.showConfirmDialog(null, "Erfolgreich eingeloggt!", "Hello", JOptionPane.DEFAULT_OPTION);
}else {//heres the error
JOptionPane.showMessageDialog(null, "Falsche Logindaten!", "Loginfehler", JOptionPane.ERROR_MESSAGE);
txtPasswort.setText(null);
txtName.setText(null);
}
Aucun commentaire:
Enregistrer un commentaire