Hangman

I have created a Hangman game that executes by asking the user to input the word to be guessed through a JOptionPane Inuput Dialog Box. The problem is that I want the prompt to be a password text field that initally asks the user for input and the goes away. Is there a way to enable the password function in JOptionPane so that the players of the game will not see the actual inputted text but just see asterisks. If not, is there an alternative way to get a Password field onto the the existing applet that works in the same way a JOptionPane Input Dialog box works ( Prompting the user and then disspears).

Thank You!

[640 byte] By [JLam] at [2007-9-26 1:26:09]
# 1

Well, you're certainly in the wrong forum (you should post in the Swing forum). You need to use a JDialog and a JPasswordField.

see the following link for JPasswordFields:

http://web2.java.sun.com/docs/books/tutorial/uiswing/components/textfield.html#password

and here's sample code, that roughly does what you want:

http://web2.java.sun.com/docs/books/tutorial/uiswing/components/example-swing/PasswordDemo.java

Good luck.

lk555 at 2007-6-29 1:08:39 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...