import java.awt.*; import java.awt.event.*; import java.applet.*; public class JTextFieldTest extends Applet implements ActionListener { TextField name,pass; public void init() { Label nameL=new Label("User Name :: ",Label.RIGHT); Label passL=new Label("Password :: ",Label.RIGHT); name=new TextField(10); pass=new TextField(10); pass.setEchoChar('*'); add(nameL); add(name); add(passL); add(pass); name.addActionListener(this); pass.addActionListener(this); } public void actionPerformed(ActionEvent ae) { repaint(); } public void paint(Graphics g) { g.drawString("USER NAME :: "+name.getText(),6,60); g.drawString("PASSWORD IS :: "+pass.getText(),6,80); } }