简体   繁体   English

Java密码字段:点代码

[英]java password field : dot code

Is there a code for the basic dot in password fields ? 密码字段中是否有用于基本点的代码? This one : dot 这个:

I have a button that shows the password (with setEchoChar()), but it's ugly if i put stars (*) when the user hide again the password. 我有一个显示密码的按钮(带有setEchoChar()),但是当用户再次隐藏密码时,如果我加星号(*),则很难看。

Thanks. 谢谢。
(and btw first post, so if there is something I should change don't hesitate to say it) (顺便说一句,所以,如果有什么我应该改变的话,请不要犹豫地说)

Here is the most important part of the code : 这是代码中最重要的部分:
if (getjCheckBox().isSelected()){ getjPasswordField().setEchoChar((char)0); } else { getjPasswordField().setEchoChar('*'); }

You can't look for an ASCII character because it's not an ASCII character but an unicode one. 您无法查找ASCII字符,因为它不是ASCII字符,而是Unicode字符。 The one you are looking for should be this one. 您正在寻找的那个应该是这个之一。

Which can be set through field.setEchoChar('\•'); 可以通过field.setEchoChar('\•');

But the more reasonable choice would be to override the default one used by the current look and feel. 但是,更合理的选择是覆盖当前外观使用的默认外观。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM