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