public class SortingFocusTraversalPolicy extends InternalFrameFocusTraversalPolicy
| Modifier | Constructor and Description |
|---|---|
protected |
SortingFocusTraversalPolicy()
Creates a new
SortingFocusTraversalPolicy with no
comparator set. |
|
SortingFocusTraversalPolicy(Comparator<? super Component> comparator)
Creates a new
SortingFocusTraversalPolicy with the given
comparator set. |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
accept(Component comp)
Decide whether a component is an acceptable focus owner.
|
protected Comparator<? super Component> |
getComparator()
Get the current value of the
comparator property. |
Component |
getComponentAfter(Container root,
Component comp)
Return the component which follows the specified component in this
focus cycle, relative to the order imposed by
comparator. |
Component |
getComponentBefore(Container root,
Component comp)
Return the component which precedes the specified component in this
focus cycle, relative to the order imposed by
comparator. |
Component |
getDefaultComponent(Container root)
Return the default component of
root, which is by default
the same as the first component, returned by getFirstComponent(java.awt.Container). |
Component |
getFirstComponent(Container root)
Return the first focusable component of the focus cycle root
comp under the ordering imposed by the comparator property. |
boolean |
getImplicitDownCycleTraversal()
Return the current value of the
implicitDownCycleTraversal
property. |
Component |
getLastComponent(Container root)
Return the last focusable component of the focus cycle root
comp under the ordering imposed by the comparator property. |
protected void |
setComparator(Comparator<? super Component> comparator)
Set the current value of the
comparator property. |
void |
setImplicitDownCycleTraversal(boolean down)
Set the current value of the
implicitDownCycleTraversal
property. |
getInitialComponentgetInitialComponentprotected SortingFocusTraversalPolicy()
SortingFocusTraversalPolicy with no
comparator set.public SortingFocusTraversalPolicy(Comparator<? super Component> comparator)
SortingFocusTraversalPolicy with the given
comparator set.comparator - the comparator to setprotected boolean accept(Component comp)
comp - The component which is a candidate for focus ownership.protected Comparator<? super Component> getComparator()
comparator property.setComparator(java.util.Comparator<? super java.awt.Component>)protected void setComparator(Comparator<? super Component> comparator)
comparator property.comparator - the new value of the propertygetComparator()public Component getComponentAfter(Container root, Component comp)
comparator. Candidate components are only considered if they are
accepted by the accept(java.awt.Component) method.
If getImplicitDownCycleTraversal() is true and the
comp is a focus cycle root, an "implicit DownCycle"
occurs and the method returns the
getDefaultComponent(comp).getComponentAfter in class FocusTraversalPolicyroot - the focus cycle root to search for a successor withincomp - the component to search for the successor ofIllegalArgumentException - if either argument is null, or
if the root is not a focus cycle root of the componentpublic Component getComponentBefore(Container root, Component comp)
comparator. Candidate components are only considered if they are
accepted by the accept(java.awt.Component) method.getComponentBefore in class FocusTraversalPolicyroot - the focus cycle root to search for a predecessor withincomp - the component to search for the predecessor ofIllegalArgumentException - if either argument is null, or
if the root is not a focus cycle root of the componentpublic Component getDefaultComponent(Container root)
root, which is by default
the same as the first component, returned by getFirstComponent(java.awt.Container).getDefaultComponent in class FocusTraversalPolicyroot - the focus cycle root to return the default component ofrootIllegalArgumentException - if root is nullpublic Component getFirstComponent(Container root)
comp under the ordering imposed by the comparator property. Candidate components are only considered if
they are accepted by the accept(java.awt.Component) method.getFirstComponent in class FocusTraversalPolicyroot - the focus cycle root to search for the first component ofroot, or null if
no components are found.IllegalArgumentException - if root is nullpublic Component getLastComponent(Container root)
comp under the ordering imposed by the comparator property. Candidate components are only considered if
they are accepted by the accept(java.awt.Component) method.getLastComponent in class FocusTraversalPolicyroot - the focus cycle root to search for the last component ofroot, or null if
no components are found.IllegalArgumentException - if root is nullpublic boolean getImplicitDownCycleTraversal()
implicitDownCycleTraversal
property.setImplicitDownCycleTraversal(boolean)public void setImplicitDownCycleTraversal(boolean down)
implicitDownCycleTraversal
property.down - the new value of the propertygetImplicitDownCycleTraversal()