package me.teridax.jcash.gui.takeoff; import me.teridax.jcash.banking.Account; public class TakeoffDialog { public TakeoffDialog(Account account, Runnable onTakeoff) { var view = new TakeoffView(); view.getTakeoff().addActionListener(e -> { account.takeoff(view.getAmount()); onTakeoff.run(); view.dispose(); }); view.getCancel().addActionListener(e -> view.dispose()); view.showDialog(); } }