import java.awt.*;
import java.awt.event.*;

class WindowCloser extends WindowAdapter {
    public void windowClosing(WindowEvent e) {
       System.exit(0);
    }
}

class MonBouton extends Button {
    int incr;
    MonBouton(String titre, int incr) {
        super(titre); this.incr = incr;
    }
    int getIncr() {return incr;}
}

class ListenerLabel extends Label implements ActionListener {
    ListenerLabel() { super("0", Label.CENTER);}
    public void actionPerformed(ActionEvent e) {
        MonBouton b = (MonBouton)e.getSource();
           int c = Integer.parseInt(getText());
           c += b.getIncr();
           setText(Integer.toString(c));
   }
}

class PlusouMoins extends Frame {
   public PlusouMoins() {
      super("Plus ou moins");
			Button oui = new MonBouton("Plus !", +1);
			Button non = new MonBouton("Moins !", -1);
			Label diff = new ListenerLabel();
      add(oui, "North");
      add(diff,"Center");
      add(non,"South");
      oui.addActionListener((ActionListener) diff);
      non.addActionListener((ActionListener) diff);
   };
 
   public static void main (String[] argv) {
      Frame r = new PlusouMoins();
      r.pack();
      r.setVisible(true);
			r.addWindowListener(new WindowCloser());
   }
}
