package me.teridax.jcash.gui.transfer; import me.teridax.jcash.banking.Account; public class TransferDialog { public TransferDialog(Account account, Runnable onDeposit) { var view = new TransferView(account); view.getDeposit().addActionListener(e -> { account.takeoff(view.getAmount()); onDeposit.run(); view.dispose(); }); view.getCancel().addActionListener(e -> view.dispose()); view.showDialog(); } }