java - How to set JavaFX password field echo char -
this question has answer here:
- bullet asterisk in passwordfield 1 answer
in swing, can set echo char setechochar
:
new jpasswordfield().setechochar('*');
how can same in javafx?
it kind of ugly, but... password mask character hardcoded default skin.
what need create own skin , implement own masking function.
there existing feature request more flexible password masking functionality:
if interested in contributing the open-jfx project javafx development, nice simple way start...
as background, here making code javafx 8 com.sun.javafx.scene.control.skin.textfieldskin.java
:
// use passwordfield public static final char bullet = '\u2022'; . . . @override protected string masktext(string txt) { if (getskinnable() instanceof passwordfield) { int n = txt.length(); stringbuilder passwordbuilder = new stringbuilder(n); (int = 0; < n; i++) { passwordbuilder.append(bullet); } return passwordbuilder.tostring(); } else { return txt; } }
so can see com.sun
class not make configurable.
Comments
Post a Comment