public void send(ActionEvent event) { try { Address destination = new Address(Main.params, address.getText()); Wallet.SendRequest req = Wallet.SendRequest.emptyWallet(destination); Main.bitcoin.wallet().sendCoins(req); Futures.addCallback( sendResult.broadcastComplete, new FutureCallback<Transaction>() { @Override public void onSuccess(Transaction result) { Platform.runLater(overlayUi::done); } @Override public void onFailure(Throwable t) { // We died trying to empty the wallet. crashAlert(t); } }); sendResult .tx .getConfidence() .addEventListener( (tx, reason) -> { if (reason == TransactionConfidence.Listener.ChangeReason.SEEN_PEERS) updateTitleForBroadcast(); }); sendBtn.setDisable(true); address.setDisable(true); updateTitleForBroadcast(); } catch (AddressFormatException e) { // Cannot happen because we already validated it when the text field changed. throw new RuntimeException(e); } catch (InsufficientMoneyException e) { informationalAlert( "Could not empty the wallet", "You may have too little money left in the wallet to make a transaction."); overlayUi.done(); } }
public void cancel(ActionEvent event) { overlayUi.done(); }
@FXML public void closeClicked(ActionEvent event) { overlayUI.done(); }