import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.*;public class ButtonSound extends JFrame {
    public ButtonSound() {
        super();
        setSize(300, 300);
        Container c = this.getContentPane();
        c.setLayout(new BorderLayout());
        JButton b = new JButton("cc");
        ActionListener action = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Toolkit.getDefaultToolkit().beep();
             
            }
        };
        b.addActionListener(action);
        c.add(b, BorderLayout.CENTER);
        setVisible(true);    }    public static void main(String args[]) {
       new ButtonSound ();
    }
}