java.awt
Class DefaultFocusTraversalPolicy
java.lang.Object
java.awt.FocusTraversalPolicy
java.awt.ContainerOrderFocusTraversalPolicy
java.awt.DefaultFocusTraversalPolicy
- All Implemented Interfaces:
- Serializable
public class DefaultFocusTraversalPolicy
- extends ContainerOrderFocusTraversalPolicy
DefaultFocusTraversalPolicy is the default focus traversal policy
used by Containers.
This policy sharpens ContainerOrderFocusTraversalPolicy's
acceptance criteria, to reject those Components that have
unfocusable peers. Despite this extra strictness, this policy will
always accept a Component that has explicitly been set focusable by
any means.
This AWT implementation assumes that the peers of the following
Components are not focusable: Canvas, Panel, Label, ScrollPane,
Scrollbar, Window, and any lightweight Component.
A Component's focusability is independent of the focusability of
its peer.
- Since:
- 1.4
- See Also:
- Serialized Form
Method Summary |
protected boolean |
accept(Component comp)
Check whether a given Component would be acceptable as a focus
owner. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultFocusTraversalPolicy
public DefaultFocusTraversalPolicy()
- Construct a default focus traversal policy.
accept
protected boolean accept(Component comp)
- Check whether a given Component would be acceptable as a focus
owner. The Component must be displayable, visible and enabled to
be acceptable. If the Component's focus traversability has been
overridden, by overriding Component.isFocusTraversable or
Component.isFocusable, or by calling Component.setFocusable, then
the Component will be accepted if it is focusable. If the
Component uses the default focus traversable behaviour, then
comp
will always be rejected if it is a Canvas,
Panel, Label, ScrollPane, Scrollbar, Window or lightweight
Component.
- Overrides:
accept
in class ContainerOrderFocusTraversalPolicy
- Parameters:
comp
- the Component to check
- Returns:
- true if the Component is an acceptable target for
keyboard input focus, false otherwise