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