tags:

views:

320

answers:

2

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?

+1  A: 

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.

thedude19
+4  A: 

IMHO the best way to solve the problem is to look how JPasswordField overrides JTextField and to make your own derivation of JTextArea.

Marian