Solved

JOptionPane.showInputDialog... (password field?)

Posted on 2004-04-24
2
3,333 Views
Last Modified: 2008-02-01
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
Comment
Question by:Programmer_to_be
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
Comment Utility
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
 
LVL 92

Expert Comment

by:objects
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
noX challenge 17 76
mapAB Challlenge 35 84
word0 challenge 4 52
Java Filesystem manipulation of Word Docx file (find replace text) 3 39
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now