From 8a377fcbfc235058067a1b6d3a3474923cde445b Mon Sep 17 00:00:00 2001 From: leewyatt Date: Tue, 4 Jun 2024 04:49:10 +0900 Subject: [PATCH] Refactor showPasswordProperty listener in EnhancedPasswordField Switched the listener on showPasswordProperty to a subscribe method in the 'EnhancedPasswordField' class. This change promotes cleaner code structure and improves the readability of the EnhancedPasswordField component's code. --- .../src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gemsfx/src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java b/gemsfx/src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java index e6e1e4ee..9d7fa85f 100644 --- a/gemsfx/src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java +++ b/gemsfx/src/main/java/com/dlsc/gemsfx/EnhancedPasswordField.java @@ -64,7 +64,8 @@ public class EnhancedPasswordField extends PasswordField { public EnhancedPasswordField() { super(); getStyleClass().add(DEFAULT_STYLE_CLASS); - showPasswordProperty().addListener(it -> pseudoClassStateChanged(SHOWING_PSEUDO_CLASS, isShowPassword())); + + showPasswordProperty().subscribe(showing -> pseudoClassStateChanged(SHOWING_PSEUDO_CLASS, showing)); //set right node FontIcon fontIcon = new FontIcon();