import java.awt.event.*; //Fortschrittsbalken
import java.awt.*;
import javax.swing.*;

public class a2 extends Panel implements ActionListener{
	Button eins= new Button("1");
	Button zwei= new Button("2");
	Button drei= new Button("3");
	int Zahl1=0;
	int Zahl2=0;
	int Zahl3=0;
	JProgressBar p1=new JProgressBar();
	JProgressBar p2=new JProgressBar();
	JProgressBar p3=new JProgressBar();
	Label ausgabe1=new Label(""+Zahl1);
	Label ausgabe2=new Label(""+Zahl2);
	Label ausgabe3=new Label(""+Zahl2);
	public a2(){
		add(eins);
		add (p1);
		add(ausgabe1);
		add(zwei);
		add (p2);
		add(ausgabe2);
		add(drei);
		add (p3);
		add(ausgabe3);
		eins.addActionListener(this);
		zwei.addActionListener(this);
		drei.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e){
	Object Knopf=e.getSource();
	
			if(Knopf==eins)Zahl1++;
			else if(Knopf==zwei)Zahl2++;
			else if(Knopf==drei)Zahl3++;
			ausgabe1.setText(""+Zahl1);
			ausgabe2.setText(""+Zahl2);
			ausgabe3.setText(""+Zahl3);
			p1.setValue(Zahl1);
			p2.setValue(Zahl2);
			p3.setValue(Zahl3);

	}
	public static void main(String args[]){
		Frame Fenster = new Frame("Aufgabe2");
		Fenster.add("Center", new a2());
		Fenster.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){System.exit(0);}});
		Fenster.pack();
		Fenster.setSize(230,120);
		Fenster.setVisible(true);
	}

}