From d040f186a207e3a67bad6a93d5a9e7ba82331061 Mon Sep 17 00:00:00 2001 From: ottosch Date: Fri, 15 Nov 2024 18:28:52 -0300 Subject: [PATCH] Close wallet name dialog with ESC --- .../sparrowwallet/sparrow/control/WalletNameDialog.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java index b9a58e51..c0d5a4f3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java @@ -10,6 +10,8 @@ import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.geometry.Insets; import javafx.scene.control.*; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import org.controlsfx.control.textfield.CustomTextField; @@ -56,6 +58,11 @@ public class WalletNameDialog extends Dialog dialogPane.getButtonTypes().addAll(ButtonType.CANCEL); dialogPane.setPrefWidth(460); dialogPane.setPrefHeight(requestBirthDate ? 250 : 200); + dialogPane.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> { + if (event.getCode() == KeyCode.ESCAPE) { + WalletNameDialog.this.close(); + } + }); AppServices.moveToActiveWindowScreen(this); Glyph wallet = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.WALLET);