Hi All, I am trying to get a large amount of data from the user via a JTextArea. However as the user types the data it appears in the textarea(normal behaviour). What I want is that a particular character appears on the screen no matter what character is pressed - A similar effect to the JPasswordField. I could use JPasswordField for this if pushed. However the user has to enter a lot of random data and I need a TextArea. I want some actual character to appear on the screen so that the user knows that they have actually pressed a "good few" keys. So, Is there a way to do this? Regards, Paul.
You want the user to enter large amounts of data without being able to SEE what they are entering. Remind me not to use your application (I am a LOUSY typist). If you go to the KeyEvent class of the API in the "see also" section they have a link to a tutorial on setting up key listeners.
"JavaRanch, where the deer and the Certified play" - David O'Meara
posted 19 years ago
To me this sounds like a random seeding method for something like generating security keys. In a case like this it's important that there is a lot of effectively un-duplicable input, so typos don't matter. Is my guess right? or do you have an even wierder use for blind typing?
Sounds like what you want to have is your own Document, either by rolling your own on top of AbstractDocument or by subclassing PlainDocument. Depending on your needs, you can either make sure that everything getsentered into the Document as stars, or that nothing but stars are ever retrieved from the Document. Maybe there is a simpler option. Have you considered looking into the source for JPasswordField? - Peter