tags:

views:

192

answers:

1

I am working on a fairly complex Java application using Swing.

On some occasions there are unwanted beeps without any user intervention. No crash, application keeps working fine, I'm respecting the EDT rules etc.

Yet in some cases a beep can be heard: I may be doing something silly triggering that beep but in any case it s not a user action for it can happen upon importing data, when the user is away.

Is it possible, for a Java application that should never ever emit any sound to configure it, say by setting a property for the whole application that says: "dont' ever emit a beep"?

I ve been Googling for that issue and I ve found message by people having the same issue but no answer: all I found was some hack saying that there was a known issue with JEditorPane and that using a putProperty("IgnoreCharsetDirective", Boolean.TRUE) was helpful to make unwanted beeps happen less often. Yet information is very scarce on the subject.

It s a real issue because the application is used in an environment where the sound is needed on the computer, but this Java application emitting noise is unacceptable.

+2  A: 

Your problem is discussed on the Java Forum:

// Write a custom toolkit
public class MyToolkit extends sun.awt.windows.WToolkit 
{
  public void beep() {
  }
}

// Set this property
System.setProperty("awt.toolkit", "MyPackage.MyToolkit");

NOTE: The use of this workaround is discouraged. You should still try to find the root of the problem.

mre
Could you print a stack trace from the beep() to find the source of the problem? e.g. `(new Exception()).printStackTrace();`
Jonathon