这个取消按钮有问题。
使用这些代码:
int deposit;
String dep =
JOptionPane.showInputDialog("How much would you like to deposit?\n\t$: ");
deposit = Integer.parseInt(dep);
应该会出现一个“确定”和“取消”按钮,但是每当我单击取消按钮时,根本没有任何响应。我想要的是,每当我点击“取消”按钮时,它应该让我回到主菜单,但是如何呢?
编码:
private static void processDeposit(String num, int rc){
int deposit;
String dep =
JOptionPane.showInputDialog(
"How much would you like to deposit?\n\t$: ");
deposit = Integer.parseInt(dep);
JOptionPane.showMessageDialog(
null, "You have deposited $" + dep + " into the account of " + name);
myAccount.setBalance(myAccount.getBalance() + deposit);
}