JPasswordField « JTextField « Java Swing Q&A





1. Simple way to have a hybrid JTextField / JPasswordField?    stackoverflow.com

I am developing a simple applet that has a simpe sign-in interface. And to be concise in space, I have two JTextFields for username and password, which I also use as ...

2. Use an input formatter and password characteristic together with swing    stackoverflow.com

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

3. JPasswordField Vs. JTextField    coderanch.com

4. Convert a JTextField to a JPasswordField    java-forums.org

I do not see why you can't use a JPasswordField, but that aside one way would be to extend one of the classes which implement the Document interface and override a few of its methods (remove, insertString, getText(), etc...). You can keep a StringBuilder variable which holds the true password value and is modified by the override methods, but in insertString ...