import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*<applet code="actionapplet" width=500 height=600></applet>*/
public class actionapplet extends Applet implements ActionListener{
String msg,str;
Button b1,b2,b3;
public void init(){
b1=new Button("substract");
b2=new Button("add");
add(b1);
add(b2);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
str=ae.getActionCommand();
if(str.equals("add"))
msg="addition is to be performed";
if(str.equals("substract"))
msg="subtraction is to be performed";
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg,10,10);
}
}
My doubt is :in the above code
in the sentence b1.addActionListener(this) what does this signify
What actualy is present there?
i read it in many books but i am unable to get a clear picture.
can anyone help me .