Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java.awt.Toolkit.getDefaultToolkit ().beep () quiet on WinXP ...

322 views
Skip to first unread message

Charles Morison

unread,
Jun 8, 2002, 6:56:52 PM6/8/02
to
I have a Document class watching user text entry into a text area and I
would like to "beep" at a user who types an invalid character into the
text area so that they will have audio as well as visual feedback (the
visual feedback being that the typed character does not appear in the
text area).

Anyway, I call "java.awt.Toolkit.getDefaultToolkit ().beep ()" and hear
nothing. This is on WinXP using 1.4.0 or 1.4.0_01 (doesn't work on
either). I scoured the bug reports and found #4458067 which was related
to a user having the same problem on Linux. The Sun bug investigator
asked the user to try the following program:

import java.awt.*;
import java.awt.event.*;

public class BeepTest {
public static void main(String[] args) {
Frame f = new Frame("BeepTest");
Button b = new Button("Beep");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Toolkit.getDefaultToolkit().beep();
}
});
f.add(b);
f.pack();
f.setVisible(true);
}
}

And they (and I) still heard no "beep". It ended up that this user had
the following problem: "Turns out that the bell volume value of the
Peripherals.Keyboard gnome control was set to zero."

So, anyone (Bueller?) know if there is a similar setting for WinXP that
could be causing me to not hear a "beep"? And if so, where to access it
(please don't tell me it is in the god-foresaken registry)?

Thanks

VK

unread,
Jun 9, 2002, 12:53:37 AM6/9/02
to
This is an outcome of the "C# vs Java" war that's going on right now.
Microsoft makes the Java sandbox more and more restricted over the OS
settings.
getDefaultToolkit() works just fine on Windows 95/98, with partial problems
on Windows MI and it near doesn't work on Windows XP.

The only really universal solution (on the applet level) I could suggest
is:

public class SomeApplet implements ...(besides anything else),
java.applet.AudioClip {
...
AudioClip beep;
...

public void init() {
beep = getAudioClip("URL/to your/beep/in *.au format");
}
...
public void actionPerformed(ActionEvent e) {
beep.play();
}
...
}


Charles Morison <mor...@mindspring.com> wrote in message
news:3D028BB4...@mindspring.com...

Knute Johnson

unread,
Jun 9, 2002, 12:57:13 AM6/9/02
to
Charles Morison wrote:

Charles:

I tried it on my XP machine and was surprised to discover that it plays a
sound and not just a tone through the speaker. The sound it makes is a
dornk. I don't have a clue the real name of the sound but would like to
know. On my previous 98 machine it didn't use the sound card to make a
sound like it does with XP. So if you don't have speakers you might not
hear a thing.

knute...


Charles Morison

unread,
Jun 10, 2002, 1:07:13 AM6/10/02
to
The machine is a Dell Inspiron 8100 which has built in speakers and a
sound card. I don't hear anything with the speakers, the headphone jack
, or the line out. So I am perplexed. The other person who responded
suspected that the default toolkit was limited in its functionality on
Win XP, but your comments seem to disprove that theory. I may try the
other person's suggestion of making a class to play an audio clip that
goes "beep". Of course, that requires that I find a "beep" or make one.

Thanks for your feedback.

Regards

0 new messages