Auditory Feedback Actions
A general framework for providing auditory feedback in response to user interface actions
was introduced in Version 1.4. BasicLookAndFeel
(as described in Chapter 26) provides most of the
support, and other L&Fs extend it in order to actually play
appropriate sounds. As of SDK 1.4.1, none of the standard L&Fs turn on any
sounds by default. Comments in the source code indicate that this has
been delayed due to sound bugs.
The list of possible actions to which a sound can be assigned is
contained in a special ActionMap
managed by BasicLookAndFeel
. It is
protected since only subclasses are likely to need access to it. They
can obtain (or create, if necessary) the map by calling getAudioActionMap( )
. The keys in this map are
shown in Table B-45. The
values are Action
s that produce
appropriate sounds when they are performed. The standard L&Fs define
inner AudioAction
classes for this
purpose.
Table B-45. Audio actions defined by BasicLookAndFeel
CheckBoxMenuItem.commandSound | InternalFrame.closeSound |
InternalFrame.maximizeSound | InternalFrame.minimizeSound |
InternalFrame.restoreDownSound | InternalFrame.restoreUpSound |
MenuItem.commandSound | OptionPane.errorSound |
OptionPane.informationSound | OptionPane.questionSound |
OptionPane.warningSound | PopupMenu.popupSound |
RadioButtonMenuItem.commandSound |
Get Java Swing, 2nd 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.