// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class VirkerIkke extends JFrame implements ActionListener {
    private JButton klik;

    public VirkerIkke() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BorderLayout());
        klik = new JButton("Klik");
        klik.setBackground(Color.GREEN);
        klik.addActionListener(this);
        getContentPane().add(klik, BorderLayout.CENTER);
        pack();
    }

    public void actionPerformed(ActionEvent ev) {
        try {
            klik.setBackground(Color.RED);
            Thread.sleep(2000);
            klik.setBackground(Color.YELLOW);
            Thread.sleep(2000);
            klik.setBackground(Color.GREEN);
        } catch (InterruptedException e) {
        }
    }

    public static void main(String[] args) {
        VirkerIkke f = new VirkerIkke();
        f.setVisible(true);
    }
}
