import java.awt.*;
import java.awt.event.*;

class ZdarzeniaOkienkowe extends WindowAdapter
{
	private Frame okno ;

	public ZdarzeniaOkienkowe (Frame ok)
	{
		if (ok==null) throw new IllegalArgumentException() ;
		okno = ok ;
	}

	public void windowClosing (WindowEvent ev)
	{
		okno.dispose() ;
	}
}

class ZdarzenieAkcji implements ActionListener
{
	private Button przycisk ;
        private Label etykietka ;

	public ZdarzenieAkcji (Button prz, Label et)
	{
		if (prz==null) throw new IllegalArgumentException() ;
		if (et==null) throw new IllegalArgumentException() ;
		przycisk = prz ;
		etykietka = et ;
	}

	public void actionPerformed (ActionEvent ev)
	{
		String napis = etykietka.getText() ;
		etykietka.setText("Mruczek") ;
		przycisk.setEnabled(false) ;
		try { Thread.sleep(1000) ; }
		catch (InterruptedException ex) {}
		przycisk.setEnabled(true) ;
		etykietka.setText(napis) ;
	}
}

class Okno extends Frame
{
	protected Button bt ;
	protected Label lab ;

	public Okno ()
	{
		super("puste okno") ;
		setSize(360,60) ;
		setLocation(50,50) ;
		addWindowListener(new ZdarzeniaOkienkowe(this)) ;
		setLayout(new FlowLayout()) ;
		lab = new Label("Jakie jest imie twojego kota?") ;
		add(lab) ;
		bt = new Button("sprawdz") ;
		bt.addActionListener(new ZdarzenieAkcji(bt,lab)) ;
		add(bt) ;
		setResizable(false) ;
		setVisible(true) ;
	}
}

public class Chwila
{
    public static void main(String[] args)
    {
        Okno okno = new Okno() ;
    }
}
