Create Password field
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JPasswordField;
import javax.swing.UIManager;
public class PasswordField extends JFrame {
public PasswordField() {
super("JPasswordField Test");
getContentPane().setLayout(new FlowLayout());
JPasswordField textField1 = new JPasswordField("m", 1);
JPasswordField textField2 = new JPasswordField("mm", 2);
getContentPane().add(textField1);
getContentPane().add(textField2);
setSize(300, 190);
setVisible(true);
}
public static void main(String argv[]) {
new PasswordField();
}
}
Related examples in the same category