JTextField tf_user = new JTextField("xyz");
panel.add(tf_user);
panel.add(new JLabel("Password"), BorderLayout.NORTH);
JPasswordField passwordField = new JPasswordField(10);
passwordField.setEchoChar('*');
panel.add(passwordField, BorderLayout.CENTER);
JOptionPane.showMessageDialog(
null,
panel,
"Enter EMail Setup Information",
JOptionPane.OK_OPTION);
this.to = tf_to.getText();
this.from = tf_from.getText();
this.host = tf_host.getText();
this.user = tf_user.getText();
this.subject= tf_subject.getText();
this.password = String.valueOf(passwordField.getPassword());
}