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()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
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
-