*********************************************************************
COMPLETE SOURCE CODE FOR : CreatePasswordFieldUsingJPasswordField.java
*********************************************************************
import javax.swing.JFrame;
import javax.swing.JPasswordField;
import java.awt.FlowLayout;
public class CreatePasswordFieldUsingJPasswordField
{
public static void main(String[]args)
{
//Create password field with number of columns equal 10
//Number of columns is use to calculate preferred size
//You can change it for what value that you want but make sure it positive integer
JPasswordField passwordField=new JPasswordField(10);
//Create JFrame that will be use to place created JPasswordField
JFrame frame=new JFrame("Create password field");
//Set JFrame layout to FlowLayout
frame.setLayout(new FlowLayout());
//Add password field into JFrame
frame.add(passwordField);
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size to :
//WIDTH : 400 pixels
//HEIGHT : 100 pixels
frame.setSize(400,100);
//Make JFrame visible. So we can see it.
frame.setVisible(true);
}
}
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************