0
JPasswordField pf = new JPasswordField();
JOptionPane.showConfirmDialog(null, pf, "Please enter password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

This is giving me the dialog box with password input field, but focus is on 'OK' button. But I need the focus on the password input field.

Sree
  • 1
  • 3
  • To use code formatting, select the code and click the {} button above message editing/posting form. – Andrew Thompson Feb 17 '16 at 06:37
  • Given reference not meeting the requirement. This should come as a pop up with the password input field with focus. Only popup (Optionpane) should be active at that time, not the main frame. In the given reference, the main frame will also be active and that is not desirable – Sree Feb 17 '16 at 10:14

0 Answers0