JPasswordTextField using JOptionPane
I want to use JPasswordTextField in JOptionPane.showInputMessage(...) dialog instead of textfield component.
I think that It may be possible using createDialog() Method of JOptionPane OR OptionPaneUI! but how?
that is I want to use an Password Dialog Box like Input Dialog of JOptionPane.
Plese tell me that how can I do this?
Thanks in advance...
[SOVED] By Alternative Way
Yes, I too agree with you. I must fillow this rule in future.
There's a Swing section where this should have been posted.
SORRY! there is a class JPasswordField in JAVA API that I wanted to mention.
There's no class called JPasswordTextField in the standard API.
I had that idea in my mind but I put this question b'coz I just wanted to know the concepts of "JOptionPane component settings" and "how to use OptionPaneUI"
Use JDialog directlys and create your own.
I created my own showPasswordDialog(...) function which is attached. Rename the MyPasswordFieldText.txt to MyPasswordFieldText.java and run it.
Thanks, but my purpose is not soved using this method.
Any component can be passed as the "message" argument to showMessageDialog
then I will not get password which will be typed in password field....kindly update my further knowledge regarding passing component as message.
String password=JOptionPane.showInputDialog(null,new JPasswordField(20));
What is the use of it?