Sets the default focus traversal keys for a given traversal operation.
This traversal key
Set
will be in effect on all
Window
s that have no such
Set
of
their own explicitly defined. This
Set
will also be
inherited, recursively, by any child
Component
of
those
Windows
that has
no such
Set
of its own explicitly defined.
The default values for the default focus traversal keys are
implementation-dependent. Sun recommends that all implementations for a
particular native platform use the same default values. The
recommendations for Windows and Unix are listed below. These
recommendations are used in the Sun AWT implementations.
Identifier |
Meaning |
Default |
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS |
Normal forward keyboard traversal |
TAB on KEY_PRESSED ,
CTRL-TAB on KEY_PRESSED |
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS |
Normal reverse keyboard traversal |
SHIFT-TAB on KEY_PRESSED ,
CTRL-SHIFT-TAB on KEY_PRESSED |
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS |
Go up one focus traversal cycle |
none |
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS |
Go down one focus traversal cycle |
none |
To disable a traversal key, use an empty
Set
;
Collections.EMPTY_SET
is recommended.
Using the AWTKeyStroke
API, client code can
specify on which of two
specific KeyEvent
s, KEY_PRESSED
or
KEY_RELEASED
, the focus traversal operation will
occur. Regardless of which KeyEvent
is specified,
however, all KeyEvent
s related to the focus
traversal key, including the associated KEY_TYPED
event, will be consumed, and will not be dispatched
to any Component
. It is a runtime error to
specify a KEY_TYPED
event as
mapping to a focus traversal operation, or to map the same event to
multiple default focus traversal operations.
Parameters:
- id - one of
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS
,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS
,
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
, or
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
- keystrokes - the Set of AWTKeyStroke
s for the
specified operation
Throws:
- IllegalArgumentException - if id is not one of
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS
,
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS
,
KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
, or
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
,
or if keystrokes is null
,
or if keystrokes contains null
,
or if any Object
in
keystrokes is not an AWTKeyStroke
,
or if any keystroke
represents a KEY_TYPED
event,
or if any keystroke already maps
to another default focus traversal operation
See Also:
KeyboardFocusManager.getDefaultFocusTraversalKeys(int)
,
Component.setFocusTraversalKeys(int, java.util.Set extends java.awt.AWTKeyStroke>)
,
Component.getFocusTraversalKeys(int)
,