Class DefaultFocusTraversalPolicy
- All Implemented Interfaces:
Serializable
Container.getComponents(). Portions of the hierarchy that are
not visible and displayable will not be searched.
If client code has explicitly set the focusability of a Component by either
overriding Component.isFocusTraversable() or
Component.isFocusable(), or by calling
Component.setFocusable(), then a DefaultFocusTraversalPolicy
behaves exactly like a ContainerOrderFocusTraversalPolicy. If, however, the
Component is relying on default focusability, then a
DefaultFocusTraversalPolicy will reject all Components with non-focusable
peers. This is the default FocusTraversalPolicy for all AWT Containers.
The focusability of a peer is implementation-dependent. Sun recommends that all implementations for a particular native platform construct peers with the same focusability. The recommendations for Windows and Unix are that Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows, and lightweight Components have non-focusable peers, and all other Components have focusable peers. These recommendations are used in the Sun AWT implementations. Note that the focusability of a Component's peer is different from, and does not impact, the focusability of the Component itself.
Please see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.
- Since:
- 1.4
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods declared in class ContainerOrderFocusTraversalPolicy
getComponentAfter, getComponentBefore, getDefaultComponent, getFirstComponent, getImplicitDownCycleTraversal, getLastComponent, setImplicitDownCycleTraversalModifier and TypeMethodDescriptiongetComponentAfter(Container aContainer, Component aComponent) Returns the Component that should receive the focus after aComponent. aContainer must be a focus cycle root of aComponent or a focus traversal policy provider.getComponentBefore(Container aContainer, Component aComponent) Returns the Component that should receive the focus before aComponent. aContainer must be a focus cycle root of aComponent or a focus traversal policy provider.getDefaultComponent(Container aContainer) Returns the default Component to focus.getFirstComponent(Container aContainer) Returns the first Component in the traversal cycle.booleanReturns whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly.getLastComponent(Container aContainer) Returns the last Component in the traversal cycle.voidsetImplicitDownCycleTraversal(boolean implicitDownCycleTraversal) Sets whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly.Methods declared in class FocusTraversalPolicy
getInitialComponentModifier and TypeMethodDescriptiongetInitialComponent(Window window) Returns the Component that should receive the focus when a Window is made visible for the first time.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
DefaultFocusTraversalPolicy
public DefaultFocusTraversalPolicy()Constructs aDefaultFocusTraversalPolicy.
-
-
Method Details
-
accept
Determines whether a Component is an acceptable choice as the new focus owner. The Component must be visible, displayable, and enabled to be accepted. If client code has explicitly set the focusability of the Component by either overridingComponent.isFocusTraversable()orComponent.isFocusable(), or by callingComponent.setFocusable(), then the Component will be accepted if and only if it is focusable. If, however, the Component is relying on default focusability, then all Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows, and lightweight Components will be rejected.- Overrides:
acceptin classContainerOrderFocusTraversalPolicy- Parameters:
aComponent- the Component whose fitness as a focus owner is to be tested- Returns:
trueif aComponent meets the above requirements;falseotherwise
-