このキャンセルボタンに問題があります。
これらのコードで:
int deposit;
String dep =
JOptionPane.showInputDialog("How much would you like to deposit?\n\t$: ");
deposit = Integer.parseInt(dep);
「OK」と「キャンセル」ボタンが表示されるはずですが、キャンセルボタンをクリックしてもまったく反応しません。私が望むのは、「キャンセル」ボタンをクリックするたびにメインメニューに戻ることだけですが、どうすればいいですか?.
コード:
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);
}