Ron
Ron

Reputation: 2265

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 mean, 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

Upvotes: 1

Views: 666

Answers (1)

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81704

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.)

Upvotes: 1

Related Questions