public class FormFocusTraversalPolicy extends SortingFocusTraversalPolicy
Code mostly copied from LayoutFocusTraversalPolicy because of package-scope constructor.
Extended to focus only on Tentackle-components, provide form wrap events and support for FocusTraversalGroups.
| Constructor and Description |
|---|
FormFocusTraversalPolicy()
Creates the default layout policy.
|
FormFocusTraversalPolicy(Comparator<? super Component> layoutComparator)
Creates a traversal policy for a given comparator.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
accept(Component component)
Determines whether the specified
Component
is an acceptable choice as the new focus owner. |
Component |
getComponentAfter(Container container,
Component component)
Returns the Component that should receive the focus after component.
|
Component |
getComponentBefore(Container container,
Component component)
Returns the Component that should receive the focus before component.
|
Component |
getFirstComponent(Container container)
Returns the first Component in the traversal cycle.
|
Component |
getLastComponent(Container container)
Returns the last Component in the traversal cycle.
|
getComparator, getDefaultComponent, getImplicitDownCycleTraversal, setComparator, setImplicitDownCycleTraversalgetInitialComponentgetInitialComponentpublic FormFocusTraversalPolicy(Comparator<? super Component> layoutComparator)
layoutComparator - the layout comparatorpublic FormFocusTraversalPolicy()
FormLayoutComparatorprotected boolean accept(Component component)
Component
is an acceptable choice as the new focus owner.
This method performs the following sequence of operations:
component is visible, displayable,
enabled, and focusable. If any of these properties is
false, this method returns false.
component is an instance of JTable,
returns true.
component is an instance of JComboBox,
then returns the value of
component.getUI().isFocusTraversable(component).
component is a JComponent
with a JComponent.WHEN_FOCUSED
InputMap that is neither null
nor empty, returns true.
DefaultFocusTraversalPolicy.accept(component).
accept in class SortingFocusTraversalPolicycomponent - the Component whose fitness
as a focus owner is to be testedtrue if component is a valid choice
for a focus owner;
otherwise false
Overridden to accept only FormComponents, FormButtons, FormTables and JPasswordFields
Component.isVisible(),
Component.isDisplayable(),
Component.isEnabled(),
Component.isFocusable(),
ComboBoxUI.isFocusTraversable(javax.swing.JComboBox),
JComponent.getInputMap(int),
DefaultFocusTraversalPolicy.accept(java.awt.Component)public Component getComponentAfter(Container container, Component component)
By default, FormFocusTraversalPolicy implicitly transfers focus down-
cycle. That is, during normal 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 container is focus traversal policy provider, the focus is always transferred down-cycle.
getComponentAfter in class SortingFocusTraversalPolicycontainer - a focus cycle root of component or a focus traversal policy providercomponent - a (possibly indirect) child of container, or
container itselfIllegalArgumentException - if container is not a focus cycle
root of component or a focus traversal policy provider, or if either container or
component is nullpublic Component getComponentBefore(Container container, Component component)
By default, LayoutFocusTraversalPolicy implicitly transfers focus down-
cycle. That is, during normal 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 container is focus traversal policy provider, the focus is always transferred down-cycle.
getComponentBefore in class SortingFocusTraversalPolicycontainer - a focus cycle root of component or a focus traversal policy providercomponent - a (possibly indirect) child of container, or
container itselfIllegalArgumentException - if container is not a focus cycle
root of component or a focus traversal policy provider, or if either container or
component is nullpublic Component getFirstComponent(Container container)
getFirstComponent in class SortingFocusTraversalPolicycontainer - a focus cycle root of component or a focus traversal policy provider whose
first Component is to be returnedIllegalArgumentException - if container is nullpublic Component getLastComponent(Container container)
getLastComponent in class SortingFocusTraversalPolicycontainer - a focus cycle root of component or a focus traversal policy provider whose
last Component is to be returnedIllegalArgumentException - if container is nullTentackle - distributed, domain- and model-driven