java.awt
Class ContainerOrderFocusTraversalPolicy

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
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
DefaultFocusTraversalPolicy sample code for java.awt.DefaultFocusTraversalPolicy definition code for java.awt.DefaultFocusTraversalPolicy

public class ContainerOrderFocusTraversalPolicy
extends FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

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.

By default, ContainerOrderFocusTraversalPolicy implicitly transfers focus down-cycle. That is, during normal forward focus traversal, the Component traversed after a focus cycle root will be the focus-cycle-root's default Component to focus. This behavior can be disabled using the setImplicitDownCycleTraversal method.

By default, methods of this class with return a Component only if it is visible, displayable, enabled, and focusable. Subclasses can modify this behavior by overriding the accept method.

This policy takes into account focus traversal policy providers. When searching for first/last/next/previous Component, if a focus traversal policy provider is encountered, its focus traversal policy is used to perform the search operation.

Since:
1.4
See Also:
Container.getComponents() sample code for java.awt.Container.getComponents() definition code for java.awt.Container.getComponents() , Serialized Form

Constructor Summary
ContainerOrderFocusTraversalPolicy sample code for java.awt.ContainerOrderFocusTraversalPolicy.ContainerOrderFocusTraversalPolicy() definition code for java.awt.ContainerOrderFocusTraversalPolicy.ContainerOrderFocusTraversalPolicy() ()
           
 
Method Summary
protected  boolean accept sample code for java.awt.ContainerOrderFocusTraversalPolicy.accept(java.awt.Component) definition code for java.awt.ContainerOrderFocusTraversalPolicy.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.
 Component sample code for java.awt.Component definition code for java.awt.Component 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) (Container sample code for java.awt.Container definition code for java.awt.Container  aContainer, Component sample code for java.awt.Component definition code for java.awt.Component  aComponent)
          Returns the Component that should receive the focus after aComponent.
 Component sample code for java.awt.Component definition code for 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) (Container sample code for java.awt.Container definition code for java.awt.Container  aContainer, Component sample code for java.awt.Component definition code for java.awt.Component  aComponent)
          Returns the Component that should receive the focus before aComponent.
 Component sample code for java.awt.Component definition code for java.awt.Component getDefaultComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getDefaultComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getDefaultComponent(java.awt.Container) (Container sample code for java.awt.Container definition code for java.awt.Container  aContainer)
          Returns the default Component to focus.
 Component sample code for java.awt.Component definition code for java.awt.Component getFirstComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) (Container sample code for java.awt.Container definition code for java.awt.Container  aContainer)
          Returns the first Component in the traversal cycle.
 boolean getImplicitDownCycleTraversal sample code for java.awt.ContainerOrderFocusTraversalPolicy.getImplicitDownCycleTraversal() definition code for java.awt.ContainerOrderFocusTraversalPolicy.getImplicitDownCycleTraversal() ()
          Returns whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly.
 Component sample code for java.awt.Component definition code for java.awt.Component getLastComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getLastComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getLastComponent(java.awt.Container) (Container sample code for java.awt.Container definition code for java.awt.Container  aContainer)
          Returns the last Component in the traversal cycle.
 void setImplicitDownCycleTraversal sample code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean) definition code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean) (boolean implicitDownCycleTraversal)
          Sets whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly.
 
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

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

public ContainerOrderFocusTraversalPolicy()
Method Detail

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)

public Component sample code for java.awt.Component definition code for java.awt.Component  getComponentAfter(Container sample code for java.awt.Container definition code for java.awt.Container  aContainer,
                                   Component sample code for java.awt.Component definition code for java.awt.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.

By default, ContainerOrderFocusTraversalPolicy implicitly transfers focus down-cycle. That is, during normal forward focus traversal, the Component traversed after a focus cycle root will be the focus-cycle- root's default Component to focus. This behavior can be disabled using the setImplicitDownCycleTraversal method.

If aContainer is focus traversal policy provider, the focus is always transferred down-cycle.

Specified by:
getComponentAfter sample code for java.awt.FocusTraversalPolicy.getComponentAfter(java.awt.Container, java.awt.Component) definition code for java.awt.FocusTraversalPolicy.getComponentAfter(java.awt.Container, java.awt.Component) in class FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
Parameters:
aContainer - a focus cycle root of aComponent or a focus traversal policy provider
aComponent - a (possibly indirect) child of aContainer, or aContainer itself
Returns:
the Component that should receive the focus after aComponent, or null if no suitable Component can be found
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if aContainer is not a focus cycle root of aComponent or focus traversal policy provider, or if either aContainer or aComponent is null

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)

public Component sample code for java.awt.Component definition code for java.awt.Component  getComponentBefore(Container sample code for java.awt.Container definition code for java.awt.Container  aContainer,
                                    Component sample code for java.awt.Component definition code for java.awt.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.

Specified by:
getComponentBefore sample code for java.awt.FocusTraversalPolicy.getComponentBefore(java.awt.Container, java.awt.Component) definition code for java.awt.FocusTraversalPolicy.getComponentBefore(java.awt.Container, java.awt.Component) in class FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
Parameters:
aContainer - a focus cycle root of aComponent or focus traversal policy provider
aComponent - a (possibly indirect) child of aContainer, or aContainer itself
Returns:
the Component that should receive the focus before aComponent, or null if no suitable Component can be found
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if aContainer is not a focus cycle root of aComponent or focus traversal policy provider, or if either aContainer or aComponent is null

getFirstComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container)

public Component sample code for java.awt.Component definition code for java.awt.Component  getFirstComponent(Container sample code for java.awt.Container definition code for java.awt.Container  aContainer)
Returns the first Component in the traversal cycle. This method is used to determine the next Component to focus when traversal wraps in the forward direction.

Specified by:
getFirstComponent sample code for java.awt.FocusTraversalPolicy.getFirstComponent(java.awt.Container) definition code for java.awt.FocusTraversalPolicy.getFirstComponent(java.awt.Container) in class FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
Parameters:
aContainer - the focus cycle root or focus traversal policy provider whose first Component is to be returned
Returns:
the first Component in the traversal cycle of aContainer, or null if no suitable Component can be found
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if aContainer is null

getLastComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getLastComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getLastComponent(java.awt.Container)

public Component sample code for java.awt.Component definition code for java.awt.Component  getLastComponent(Container sample code for java.awt.Container definition code for java.awt.Container  aContainer)
Returns the last Component in the traversal cycle. This method is used to determine the next Component to focus when traversal wraps in the reverse direction.

Specified by:
getLastComponent sample code for java.awt.FocusTraversalPolicy.getLastComponent(java.awt.Container) definition code for java.awt.FocusTraversalPolicy.getLastComponent(java.awt.Container) in class FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
Parameters:
aContainer - the focus cycle root or focus traversal policy provider whose last Component is to be returned
Returns:
the last Component in the traversal cycle of aContainer, or null if no suitable Component can be found
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if aContainer is null

getDefaultComponent sample code for java.awt.ContainerOrderFocusTraversalPolicy.getDefaultComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getDefaultComponent(java.awt.Container)

public Component sample code for java.awt.Component definition code for java.awt.Component  getDefaultComponent(Container sample code for java.awt.Container definition code for java.awt.Container  aContainer)
Returns the default Component to focus. This Component will be the first to receive focus when traversing down into a new focus traversal cycle rooted at aContainer. The default implementation of this method returns the same Component as getFirstComponent.

Specified by:
getDefaultComponent sample code for java.awt.FocusTraversalPolicy.getDefaultComponent(java.awt.Container) definition code for java.awt.FocusTraversalPolicy.getDefaultComponent(java.awt.Container) in class FocusTraversalPolicy sample code for java.awt.FocusTraversalPolicy definition code for java.awt.FocusTraversalPolicy
Parameters:
aContainer - the focus cycle root or focus traversal policy provider whose default Component is to be returned
Returns:
the default Component in the traversal cycle of aContainer, or null if no suitable Component can be found
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if aContainer is null
See Also:
getFirstComponent(java.awt.Container) sample code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container)

setImplicitDownCycleTraversal sample code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean) definition code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean)

public void setImplicitDownCycleTraversal(boolean implicitDownCycleTraversal)
Sets whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly. If true, during normal forward focus traversal, the Component traversed after a focus cycle root will be the focus-cycle-root's default Component to focus. If false, the next Component in the focus traversal cycle rooted at the specified focus cycle root will be traversed instead. The default value for this property is true.

Parameters:
implicitDownCycleTraversal - whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly
See Also:
getImplicitDownCycleTraversal() sample code for java.awt.ContainerOrderFocusTraversalPolicy.getImplicitDownCycleTraversal() definition code for java.awt.ContainerOrderFocusTraversalPolicy.getImplicitDownCycleTraversal() , getFirstComponent(java.awt.Container) 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()

public boolean getImplicitDownCycleTraversal()
Returns whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly. If true, during normal forward focus traversal, the Component traversed after a focus cycle root will be the focus-cycle-root's default Component to focus. If false, the next Component in the focus traversal cycle rooted at the specified focus cycle root will be traversed instead.

Returns:
whether this ContainerOrderFocusTraversalPolicy transfers focus down-cycle implicitly
See Also:
setImplicitDownCycleTraversal(boolean) sample code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean) definition code for java.awt.ContainerOrderFocusTraversalPolicy.setImplicitDownCycleTraversal(boolean) , getFirstComponent(java.awt.Container) sample code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container) definition code for java.awt.ContainerOrderFocusTraversalPolicy.getFirstComponent(java.awt.Container)

accept sample code for java.awt.ContainerOrderFocusTraversalPolicy.accept(java.awt.Component) definition code for java.awt.ContainerOrderFocusTraversalPolicy.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. By default, this method will accept a Component if and only if it is visible, displayable, enabled, and focusable.

Parameters:
aComponent - the Component whose fitness as a focus owner is to be tested
Returns:
true if aComponent is visible, displayable, enabled, and focusable; false otherwise