import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;


public class EinKnopfV2 extends JFrame implements ActionListener{
  //private int count=0;
  //private JButton jb= new JButton("Gedrückt: "+count);
  private JButton jb= new JButton("Nicht gedrueckt!");
  public EinKnopfV2(){
    super("Knopf V2");
    jb.addActionListener(this);
    add(jb);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
        pack();
  }

  public void actionPerformed(ActionEvent ev){
    //jb.setText("Gedrückt: "+(++count));
    jb.setText("Gedrueckt");
}

    public static void main(String[] args) {
        new EinKnopfV2();
    }

}
