import java.awt.*;
import java.awt.event.*;
public class MyHandler extends WindowAdapter implements ActionListener
{
      Button n, b1, b2, bq; Frame f;
   public MyHandler(Frame win, Button b1, Button b2, Button b3, Button n ) {  // Constructor
       this.n = n;   this.b1 = b1;   bq = b3; 
       this.f = win;  this.b2 = b2;
   }
   public void actionPerformed (ActionEvent evt){
      if(evt.getSource( ) == n){
          n.setBackground(Color.red); n.setLabel(" 777 ");}
      if(evt.getSource( ) == b1) n.setLabel("Eleven");
      if(evt.getSource( ) == bq) System.exit(0);
      if(evt.getSource( ) == b2) {
            n.setBackground(Color.green);
            System.out.println("ABC haha");
      }
      f.show( );  // so that Layout Manager ...
   }
  public void windowActivated(WindowEvent e){ }
  public void windowClosed(WindowEvent e){ 
  }
  public void windowClosing(WindowEvent e){
     System.exit(0); 
  }
  //public void windowDeactivated(WindowEvent e){ }
  //public void windowIconified(WindowEvent e){ }
  //public void windowDeiconified(WindowEvent e){ }
  //public void windowOpened(WindowEvent e){ }
}

