import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=prg6
width=500 height=100>
</applet>
*/
public class prg6 extends Applet implements ActionListener
{
int i;
String s;
Label l1=new Label("Counter :");
TextField f1=new TextField();
Button b1=new Button("Count");
public void init()
{
b1.addActionListener(this);
f1.setText(null);
setLayout(null);
add(l1);
add(f1);
add(b1);
l1.setBounds(10,10,80,20);
f1.setBounds(100,10,80,20);
b1.setBounds(200,10,80,20);
}
public void start()
{
i=0;
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
s=String.valueOf(i);
f1.setText(s);
}
i=i+1;
}
public void paint(Graphics g)
{
showStatus("Sanjay Chauhan");
}
}
Counter java Code Applet
Reviewed by Unknown
on
5:46 pm
Rating:
No comments: