AddActionListener(this) what does that mean

addActionListener(this) what is this used for ??
thanxs

here is my whole code just want to add another button that will - total from another number impoted by the used
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class calculator2 extends Applet implements ActionListener
int total;
Label label1, label2,label3,label4;
TextField text1, text2,text3, text4;
Button clicker;
public void init()
label1 = new Label ("Input Rent");
label2 = new Label ("Input Bills");
label3 = new Label ("Input mobile bills");
label4 = new Label ("Input food bills");
text1 = new TextField (5);
text2 = new TextField (5);
text3 = new TextField (5);
text4 = new TextField (5);
clicker = new Button("Calculate");
add(label1);
add(text1);
add(label2);
add(text2);
add(label3);
add(text3);
add(label4);
add(text4);
add(clicker);
clicker.addActionListener(this);
} // end init
public void paint (Graphics g)
g.drawString ("The total is " + total, 50,100);
} // end paint
public void actionPerformed (ActionEvent e)
total = Integer.parseInt(text1.getText()) Integer.parseInt(text2.getText()) Integer.parseInt(text3.getText()) +Integer.parseInt(text4.getText());
repaint();
} // end actionPerformed
} // end class
anyhelp would be great thanxs

Similar Messages

Maybe you are looking for