How to convert Password field in '*'

Hi folks!

In my GUI i have to hide password by '*'. How I can do it? I am using Swing and not sure which JTextField method should I use. I know in AWT i can say something like this

JTextField txpassword =new JTextField(10);

txpassword.setLocation(70,50);

txpassword.setSize(100,20);

txpassword.setFont(f);

//To hide password

txpassword.setEchoChar('*');

But what about Swing?

Thanks in advance

[549 byte] By [asyed01a] at [2007-11-27 9:01:54]
# 1
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JPasswordField.html
hunter9000a at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...
# 2
a JTextField doesnt hide what is written, but in swing there is another component to do that. you can check it on the link posted above.
MelGohana at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...
# 3
... waiting for the questions about converting char[] to String...
BigDaddyLoveHandlesa at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...
# 4
Thanks alot. I change JTextField with JPasswordField. One more problem. How can i disable my JButton(I am using swing)?I know there is a button.Disable method in AWT what about swing?
asyed01a at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...
# 5
Here's a handy URL you'll want to bookmark: http://java.sun.com/javase/6/docs/api/By the way, the "disable" method is deprecated. Its API suggests you use setEnabled ;-)
BigDaddyLoveHandlesa at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...
# 6
setEnabled(false);
_helloWorld_a at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...
# 7
JButton.setEnabled(boolean)
hunter9000a at 2007-7-12 21:32:00 > top of Java-index,Java Essentials,New To Java...