import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
< applet code="Applet9" width= 380 height= 150>
< /applet>
*/
public class Applet9 extends Applet implements ActionListener
{
TextField name, age, dob, no;
public void init()
{
Label namea = new Label("Name : " , Label.RIGHT);
Label agea = new Label("Age: " , Label.RIGHT);
Label doba = new Label("D.O.B : " , Label.RIGHT);
Label noa = new Label("Mob No. : " , Label.RIGHT);
name = new TextField(15);
age = new TextField(15);
dob = new TextField(15);
no = new TextField(15);
add(namea);
add(name);
add(agea);
add(age);
add(doba);
add(dob);
add(noa);
add(no);
name.addActionListener(this);
age.addActionListener(this);
dob.addActionListener(this);
no.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
repaint();
}
public void paint(Graphics g)
{
g.drawString("Name : " + name.getText(), 6, 60);
g.drawString("Age : " + age.getText(), 6, 80);
g.drawString("DOB : " + dob.getText(), 6, 100);
g.drawString("Mob No :" + no.getText(), 6, 120);
}
}
Output: