Skip to content

Commit

Permalink
Refactor showPasswordProperty listener in EnhancedPasswordField
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
leewyatt committed Jun 3, 2024
1 parent da1b6b3 commit 8a377fc
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 8a377fc

Please sign in to comment.