wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes jPasswordField is not working please help.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "jPasswordField is not working please help.." Watch "jPasswordField is not working please help.." New topic
Author

jPasswordField is not working please help..

Soumya Rout
Ranch Hand

Joined: Aug 06, 2009
Posts: 49

Hi,
In a login applcation i have used the jPasswordField control. To retrieve the user input i've used as usual method getText(). And after getting the value will be compared with the database.

but first i cant retrive text from the passwordfield


please anyone tell me how this problem can be sort out.



regards



som
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

Use JPasswordField#getPassword() instead.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Soumya Rout
Ranch Hand

Joined: Aug 06, 2009
Posts: 49

Sorry ive given the control name. i have changed the Jpasswordfield name and its working now..
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

Even then, you should not be using getText()
From the JPasswordField API
Deprecated. As of Java 2 platform v1.2, replaced by getPassword.
Returns the text contained in this TextComponent. If the underlying document is null, will give a NullPointerException.
For security reasons, this method is deprecated. Use the * getPassword method instead.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jPasswordField is not working please help..
 
Similar Threads
which class to use for password with no echo(not Console class)
JPasswordField
Password Circles
regarding the JPasswordField
JOptionPane (showInputDialog())