Solved

JOptionPane.showInputDialog... (password field?)

Posted on 2004-04-24
2
3,482 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
ID: 10909662
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
ID: 10909805
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
use lov values 2 71
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 74
IBM TS2900 (3572) Tape Autoloader Java? 12 53
JDBC performance 8 28
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

680 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