package day;
import java.awt.*;
import java.awt.event.*;
/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */
class myActionHandler implements ActionListener {
  MyEventFrame f;
  myActionHandler(MyEventFrame f) {
    this.f =f;
  }
  public void actionPerformed(ActionEvent e){
    int op1 = Integer.parseInt(f.t1.getText());
    int op2 = Integer.parseInt(f.t2.getText());
    f.t3.setText(String.valueOf(op1+op2));
  }
}
public class MyEventFrame extends Frame implements ActionListener {
    TextField t1, t2, t3;
  public MyEventFrame() {
    Panel p = new Panel();

    t1 = new TextField(10);
    t2 = new TextField(10);
    t3 = new TextField(10);
    this.addWindowListener(new myWindowHandler());
    Button b = new Button("=");

    p.add(t1);
    p.add(t2);
    p.add(b);
    p.add(t3);
    b.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      int op1 = Integer.parseInt(t1.getText());
      int op2 = Integer.parseInt(t2.getText());
      t3.setText(String.valueOf(op1+op2));
      }
    });
    this.add(p, BorderLayout.NORTH);
    setSize(400, 300);
    setVisible(true);
  }

  class myWindowHandler extends WindowAdapter {
    public void windowClosing(WindowEvent e) {
      System.exit(0);
    }
  }
  public void actionPerformed(ActionEvent e) {
    int op1 = Integer.parseInt(t1.getText());
    int op2 = Integer.parseInt(t2.getText());
    t3.setText(String.valueOf(op1+op2));

  }
  public static void main(String[] args) {
    MyEventFrame myEventFrame1 = new MyEventFrame();
  }

}
