Swing Aural Cues

GUI toolkits, such as Swing, typically play short sounds or cues when specific events occur. The display of an error dialog box will cause an “alert” sound of some sort to let the user know that an error has occurred, for example. And selecting a checkbox might cause a subtle click, to provide a layer of aural feedback and reassure the user that the selection was in fact made. Swing uses a pluggable look-and-feel layer, and any aural cues are the responsibility of the installed look-and-feel. In most cases, no programmatic intervention is required, and the aural cues provided by the look-and-feel can simply be accepted as they are. The API for configuring these aural cues is essentially undocumented. See Example 11-28 for a way to turn aural cues on and off.

Get Java Examples in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.