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 Actions 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 |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access