Hey guys,when i go to enter the same account number as i am logged into as well as any other account and click ok the error message displays however it does not stop me from progressing to transfer money to myself. I have had a shot at it however as i'm new and not sure what to do?
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
String id = passwordField.getText(); //gets "input" from text entry
String transferaccount_id = atmData.getTransferaccount_id(id);
String accountbalance = atmData.getAccountbalance(id);
if (QUIT.equals(cmd)) { //User hits Quit button.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
atm.loginGUI();
}
});
}
if (CONTINUE.equals(cmd)) {
char[] pwid = passwordField.getPassword();
String intransferaccount_id = new String (pwid);
if (transferaccount_id.isEmpty()) { // Account matches return from atmData.getid_inf
JOptionPane.showMessageDialog(controllingFrame,
"Invalid Account Number. Try again.",
"Error Message",
JOptionPane.ERROR_MESSAGE);
}else if (intransferaccount_id.equals(transferaccount_id)){
JOptionPane.showMessageDialog(controllingFrame,
"The account you have selected to transfer funds to is " + atmData.getTransferaccount_id (id));
atm.transferamountGUI();
if (intransferaccount_id.equals(transferaccount_id)){
String newBalance1 = atmData.getBalance();
for (int i = 0; i <= lines ; i++) {
newBalance1 = accountbalance;
lineTo = i;
break;
}
if (transferaccount_id==transferaccount_id){
JOptionPane.showMessageDialog(controllingFrame,
"You cannot transfer money to yourself!. Try again.",
"Error Message",
JOptionPane.ERROR_MESSAGE);
}
}
}
}
}
as you can see i have added this method to try and stop it however it continues to progress!
if (transferaccount_id==transferaccount_id){ JOptionPane.showMessageDialog(controllingFrame,
"You cannot transfer money to yourself!. Try again.",
"Error Message",
JOptionPane.ERROR_MESSAGE);