import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class FrameDemo 

{
	public void actionPerformed(ActionEvent e) 

	{
		Toolkit.getDefaultToolkit().beep();
	}
	public static void main(String s[]) 

	{
        JFrame frame = new JFrame("FrameDemo");

        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

		button = new JButton("Kliknij mnie");
        button.setPreferredSize(new Dimension(175, 100));
		button.addActionListener(actionPerformed);
		frame.getContentPane().add(button, BorderLayout.CENTER);

        frame.pack();
        frame.setVisible(true);
    }
}
