Reputation: 267
Can I modify a Java Swing JTextArea
so that is doesn't display charaters typed? Can I make it display only '*' chars in the same way that a JPasswordField
class does?
Upvotes: 0
Views: 529
Reputation: 2667
IMHO the best way to solve the problem is to look how JPasswordField overrides JTextField and to make your own derivation of JTextArea.
Upvotes: 5
Reputation: 2673
Well, aside from using JPasswordField (which is just a subclass of JTextField), you could replace every character with * on each key press, and store the actual text in a string or an array of chars.
Upvotes: 1