java.awt
Class DefaultFocusTraversalPolicy

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy 
      extended by java.awt.ContainerOrderFocusTraversalPolicy sample code for java.awt.ContainerOrderFocusTraversalPolicy definition code for java.awt.ContainerOrderFocusTraversalPolicy 
          extended by java.awt.DefaultFocusTraversalPolicy
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class DefaultFocusTraversalPolicy
extends ContainerOrderFocusTraversalPolicy sample code for java.awt.ContainerOrderFocusTraversalPolicy definition code for java.awt.ContainerOrderFocusTraversalPolicy

A FocusTraversalPolicy that determines traversal order based on the order of child Components in a Container. From a particular focus cycle root, the policy makes a pre-order traversal of the Component hierarchy, and traverses a Container's children according to the ordering of the array returned by 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:
Container.getComponents() sample code for java.awt.Container.getComponents() definition code for java.awt.Container.getComponents() , Component.isFocusable() sample code for java.awt.Component.isFocusable() definition code for java.awt.Component.isFocusable() , Component.setFocusable(boolean) sample code for java.awt.Component.setFocusable(boolean) definition code for java.awt.Component.setFocusable(boolean) , Serialized Form

Constructor Summary
DefaultFocusTraversalPolicy sample code for java.awt.DefaultFocusTraversalPolicy.DefaultFocusTraversalPolicy() definition code for java.awt.DefaultFocusTraversalPolicy.DefaultFocusTraversalPolicy() ()
           
 
Method Summary
protected  boolean accept sample code for java.awt.DefaultFocusTraversalPolicy.accept(java.awt.Component) definition code for java.awt.DefaultFocusTraversalPolicy.accept(java.awt.Component) (Component sample code for java.awt.Component definition code for java.awt.Component  aComponent)
          Determines whether a Component is an acceptable choice as the new focus owner.
 
Methods inherited from class java.awt.ContainerOrderFocusTraversalPolicy sample code for java.awt.ContainerOrderFocusTraversalPolicy definition code for java.awt.ContainerOrderFocusTraversalPolicy
getComponentAfter sample code for java.awt.ContainerOrderFocusTraversalPolicy.getComponentAfter(java.awt.Container, java.awt.Component) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getComponentAfter(java.awt.Container, java.awt.Component) , getComponentBefore sample code for java.awt.ContainerOrderFocusTraversalPolicy.getComponentBefore(java.awt.Container, java.awt.Component) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getComponentBefore(java.awt.Container, java.awt.Component) , getDefaultComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getDefaultComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getDefaultComponent(java.awt.Container) , getFirstComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) , getImplicitDownCycleTraversal sample code for java.awt.ContainerOrderFocusTraversalPolicy.getImplicitDownCycleTraversal() definition code for java.awt.ContainerOrderFocusTraversalPolicy.getImplicitDownCycleTraversal() , getLastComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getLastComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getLastComponent(java.awt.Container) , setImplicitDownCycleTraversal sample code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean) definition code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean)
 
Methods inherited from class java.awt.FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
getInitialComponent sample code for java.awt.FocusTraversalPolicy.getInitialComponent(java.awt.Window) definition code for java.awt.FocusTraversalPolicy.getInitialComponent(java.awt.Window)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

DefaultFocusTraversalPolicy sample code for java.awt.DefaultFocusTraversalPolicy() definition code for java.awt.DefaultFocusTraversalPolicy()

public DefaultFocusTraversalPolicy()
Method Detail

accept sample code for java.awt.DefaultFocusTraversalPolicy.accept(java.awt.Component) definition code for java.awt.DefaultFocusTraversalPolicy.accept(java.awt.Component)

protected boolean accept(Component sample code for java.awt.Component definition code for java.awt.Component  aComponent)
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 overriding Component.isFocusTraversable() or Component.isFocusable(), or by calling Component.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:
accept sample code for java.awt.ContainerOrderFocusTraversalPolicy.accept(java.awt.Component) definition code for java.awt.ContainerOrderFocusTraversalPolicy.accept(java.awt.Component) in class ContainerOrderFocusTraversalPolicy sample code for java.awt.ContainerOrderFocusTraversalPolicy definition code for java.awt.ContainerOrderFocusTraversalPolicy
Parameters:
aComponent - the Component whose fitness as a focus owner is to be tested
Returns:
true if aComponent meets the above requirements; false otherwise