Ho to get system native password mask symbol in Java? It can be star in old Windows, big 开发者_Go百科circle in new Windows, some other symbol in Linux and mac.
Update: swing solution is required
In AWT:
TextField password = new TextField(8);
password.getEchoChar();
In Swing:
JPasswordField jpf = new JPasswordField();
jpf.getEchoChar();
In the console, it is a bit tricky to set (check http://java.sun.com/developer/technicalArticles/Security/pwordmask/). To get, maybe playing with Console.writer()
.
Anyway, why on earth would you want to get that echo char?
精彩评论