Example usage for java.awt Toolkit beep

List of usage examples for java.awt Toolkit beep

Introduction

In this page you can find the example usage for java.awt Toolkit beep.

Prototype

public abstract void beep();

Source Link

Document

Emits an audio beep depending on native system settings and hardware capabilities.

Usage

From source file:Main.java

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

From source file:PopupMenu.java

public static void main(String[] args) {
    JFrame frame = new JFrame("JPopupMenu");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final Toolkit toolkit = frame.getToolkit();

    final JPopupMenu menu = new JPopupMenu();
    JMenuItem menuItemBeep = new JMenuItem("Beep");

    menuItemBeep.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            toolkit.beep();
        }/*w w w. ja v  a 2  s.  co m*/
    });

    menu.add(menuItemBeep);

    JMenuItem menuItemClose = new JMenuItem("Close");
    menuItemClose.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });

    menu.add(menuItemClose);
    frame.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent e) {
            if (e.getButton() == e.BUTTON3) {
                menu.show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });

    frame.setSize(250, 200);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:Main.java

/**
 * 
 */
public static void beep() {

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    toolkit.beep();
}