public class asd extends JFrame{ public asd() { // TODO Auto-generated constructor stub Container c = getContentPane(); setVisible(true); setSize(300,200); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JPasswordField jp = new JPasswordField(); c.add(jp); } public static void main(String[] args) { // TODO Auto-generated method stub new asd(); } }