From a00930aa9e5e9a963f3cfc60b463dd649e4ed842 Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 23 Oct 2024 12:03:45 -0400 Subject: [PATCH] focus on password input in password dialog window --- .../main/java/haveno/desktop/app/HavenoAppMain.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/desktop/src/main/java/haveno/desktop/app/HavenoAppMain.java b/desktop/src/main/java/haveno/desktop/app/HavenoAppMain.java index 353895e6..a1aee58c 100644 --- a/desktop/src/main/java/haveno/desktop/app/HavenoAppMain.java +++ b/desktop/src/main/java/haveno/desktop/app/HavenoAppMain.java @@ -38,6 +38,7 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; +import javafx.stage.Window; import lombok.extern.slf4j.Slf4j; import java.util.Optional; @@ -228,6 +229,17 @@ public class HavenoAppMain extends HavenoExecutable { return null; } }); + + // Focus the password field when dialog is shown + Window window = getDialogPane().getScene().getWindow(); + if (window instanceof Stage) { + Stage dialogStage = (Stage) window; + dialogStage.focusedProperty().addListener((observable, oldValue, newValue) -> { + if (newValue) { + passwordField.requestFocus(); + } + }); + } } } }