import java.awt.*;
import java.awt.event.*;
public class GiGi4 implements ActionListener{
      Frame f = new Frame("Window 2004");
      Button b1,b2,b3;
      Panel p;       Button n, bq;
   public static void main( String s[ ]) {
      new GiGi4( );   /* easy to change to Applet */
   }
   public GiGi4( ) {  // Constructor
      f.setSize(300,200);
      b1=new Button("111"); b2=new Button("222");
      p = new Panel();  f.add(p,"South");
      f.add(b1,"West");  f.add(b2,"East");
      bq = new Button("Quit");
      n= new Button("HahaHehehe");
      p.add(n); p.add(bq);
      n.setBackground(Color.green);
      n.addActionListener(this);  // register with ActionListener
      b1.addActionListener(this);
      bq.addActionListener(this);   // now bq is global
      f.setVisible(true);  // f.show( );  previously
   }
   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) f.dispose( ); // bye
      f.validate( );  // so that Layout Manager ...
   }
}
