Use an input formatter and password characteristic together with swing
I'm trying to make a Password field with Swing, but apply as well a format. I mea开发者_开发知识库n, i want the password field to be treated as a formatted field (following a specified format like 6 numbers separated with - each two) but instead of show the input, behaves like password field and show just * for each letter. Is that possible?
Thanks in advance, Cheers
This would not be too terribly hard to do. You would add a TextListener
to your JPasswordField
. The TextListener
would be notified of changes to the password text, and you'd have the chance to reject the changes (i.e., change it back.)
精彩评论