Actions and provides
a variety of methods for accessing and updating these mappings.
One last interface you can use to customize your
application without implementing your own L&F is
Normally, an L&F defines a set of meaningful keystrokes. For
example, Windows users expect Ctrl-C to copy text and Ctrl-V to paste
while the Mac uses the Command key instead. Ctrl-Insert and
Shift-Insert perform the same tasks for Motif users. These key
sequences work as expected in Swing text components because of the
Keymap installed by the L&F.
This interface lets you change or augment this behavior.
Keymap interface has
been available to Swing text components since the beginning.
SDK 1.3 introduced the more flexible and universal
keyboard event system based on
ActionMaps (described in Chapter 3). The techniques
illustrated in this section remain useful:
Keymap support was reimplemented using the
new mechanism for backward compatibility. This approach is still
quite convenient if all you need is to add a couple of keyboard
commands to a text component. Also be sure to learn how to use
ActionMap directly—they give you more
capabilities, in many more situations.
Keymap interface defines the properties shown in Table 21-8. The
boundKeyStrokes properties contain the
KeyStrokes (both part of the
javax.swing package) local to the
Table 21-8. Keymap ...