Hi well I been trying to get this working for about 1 hour now. It is a login system, and you create an account and stuff, but I haven't programmed in a long time so I am getting use to java again and I know this isnt anything good but its for me to get warmed back up. Well here is my code.
My problem is everytime I try to logon I get invalid username and password no matter what I do. Even though in the username.txt and password.txt it is correct. Anyone care to help me fix this problem?
Thanks.
Fate
EDIT: This is only part of the code.. not the whole thing!
Code:
}
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == logOn) {
try {
BufferedReader readUsername = new BufferedReader(new FileReader("username.txt"));
String userName = readUsername.readLine();
readUsername.close();
try {
BufferedReader readPassword = new BufferedReader(new FileReader("password.txt"));
String passWord = readPassword.readLine();
readPassword.close();
if (userName.equals(username) && passWord.equals(password)) {
JOptionPane.showMessageDialog(this, "Log in Success!", "Success!", JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(this, "Invalid Username/Passowrd!", "Invalid!", JOptionPane.INFORMATION_MESSAGE);
}
} catch (IOException ioe) {
}
} catch (IOException ioe) {
}
return;
}
My problem is everytime I try to logon I get invalid username and password no matter what I do. Even though in the username.txt and password.txt it is correct. Anyone care to help me fix this problem?
Thanks.
Fate
EDIT: This is only part of the code.. not the whole thing!









