Ask Questions?

View Latest Questions

Advertisement


 
 

Beep
Posted on: July 26, 2006 at 12:00 AM
A beep sound can be use to indicate a warning or error.

Java Notes

Beep

A beep sound can be use to indicate a warning or error. However, it is often better to give a warning dialog box with a description of the problem.

To Produce a Beep Sound

  1. You need to import the Toolkit class:
       import java.awt.Toolkit;
  2. Use this statment in your code:
       Toolkit.getDefaultToolkit().beep();
This is not always a sufficient way to alert the user as there may not be sound on the user's computer (as in many student labs) or the sound may be turned down, etc.
Copyleft 2003 Fred Swartz MIT License, Last update: 2001-09-20
Advertisement


DMCA.com