[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3857
  • Last Modified:

JOptionPane.showInputDialog... (password field?)

hi,

i'd like to use a JOptionPane to allow the user to supply a password in. Is there any way of making the text field in the JOptionPane.showInputDialog not show the characters being typed in it ?(like a JPasswordField)

Thanks,
Programmer_to_be
0
Programmer_to_be
Asked:
Programmer_to_be
  • 2
1 Solution
 
objectsCommented:
try:

         JPasswordField jpf = new JPasswordField(30);
         JPanel messagePanel = new JPanel();
         messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.Y_AXIS));
         messagePanel.add(new JLabel("Enter password:"));
         messagePanel.add(jpf);
         int result = JOptionPane.showConfirmDialog(null, messagePanel,  "Enter Password",
0
 
objectsCommented:
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now