Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 Swing 创建一个密码字段,但也应用一种格式。我的意思是,我希望将密码字段视为格式化字段(遵循指定格式,例如 6 个数字,每两个数字隔开),但不是显示输入,而是像密码字段一样,每个字母只显示 *。那可能吗?
在此先感谢,干杯
这不会太难做到。你会在TextListener你的JPasswordField. 将TextListener通知密码文本的更改,您将有机会拒绝更改(即,将其更改回来。)
TextListener
JPasswordField