Skip to content

Commit

Permalink
8269026: PasswordField doesn't render bullet character on Android
Browse files Browse the repository at this point in the history
Reviewed-by: kcr
  • Loading branch information
Jose Pereda committed Jun 18, 2021
1 parent 171e484 commit 13cffba
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javafx.beans.value.ChangeListener;
import javafx.beans.value.WeakChangeListener;
import javafx.event.EventHandler;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;

Expand All @@ -39,6 +40,8 @@ public class TextFieldSkinAndroid extends TextFieldSkin {
*
**************************************************************************/

private static final char BULLET = '\u2022';

private final EventHandler<MouseEvent> mouseEventListener = e -> {
if (getSkinnable().isEditable() && getSkinnable().isFocused()) {
showSoftwareKeyboard();
Expand Down Expand Up @@ -71,6 +74,15 @@ public TextFieldSkinAndroid(final TextField textField) {
* *
**************************************************************************/

/** {@inheritDoc} */
@Override protected String maskText(String txt) {
if (getSkinnable() instanceof PasswordField) {
return String.valueOf(BULLET).repeat(txt.length());
} else {
return super.maskText(txt);
}
}

/** {@inheritDoc} */
@Override public void dispose() {
if (getSkinnable() == null) return;
Expand Down

1 comment on commit 13cffba

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.