public class DockFocusTraversalPolicy
extends java.awt.FocusTraversalPolicy
FocusTraversalPolicy
that uses the algorithms of a SimplifiedFocusTraversalPolicy
to do its work. This policy ensures that only valid Component
s
are selected, and it respects the constraints for nested policies.Constructor and Description |
---|
DockFocusTraversalPolicy(SimplifiedFocusTraversalPolicy policy,
boolean circle)
Creates a new policy.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(java.awt.Component component)
Tells whether
component can be focused or not. |
protected java.awt.Component |
after(java.awt.Component component)
Searches the next
Component which might gain the focus. |
protected java.awt.Component |
before(java.awt.Component component)
Searches the previous
Component which might gain the focus. |
java.awt.Component |
getComponentAfter(java.awt.Container container,
java.awt.Component component) |
java.awt.Component |
getComponentBefore(java.awt.Container container,
java.awt.Component component) |
java.awt.Component |
getDefaultComponent(java.awt.Container container) |
java.awt.Component |
getFirstComponent(java.awt.Container container) |
protected java.awt.FocusTraversalPolicy |
getFocusTraversalPolicy(java.awt.Container provider)
Searches the
FocusTraversalPolicy which should be used by
provider . |
java.awt.Component |
getLastComponent(java.awt.Container container) |
protected java.awt.Container |
getRootOrProvider(java.awt.Component component)
Searches the first parent of
component that is either
a focus cycle root or
a policy provider . |
public DockFocusTraversalPolicy(SimplifiedFocusTraversalPolicy policy, boolean circle)
policy
- the delegate providing algorithms for this policycircle
- if true
then this policy does not respect
the exact description of the functionality of FocusTraversalPolicy
in order to ensure that getComponentAfter( getComponentBefore( x )) == x
and
getComponentBefore( getComponentAfter( x )) == x
.protected boolean accept(java.awt.Component component)
component
can be focused or not.component
- some Component
which might gain the focus.true
if component
is allowed to
gain the focus, false
otherwisepublic java.awt.Component getComponentAfter(java.awt.Container container, java.awt.Component component)
getComponentAfter
in class java.awt.FocusTraversalPolicy
protected java.awt.Component after(java.awt.Component component)
Component
which might gain the focus. This
method searches recursively through the tree of Component
s, but
does not loop.component
- the currently focused Component
.Component
which might gain the focuspublic java.awt.Component getComponentBefore(java.awt.Container container, java.awt.Component component)
getComponentBefore
in class java.awt.FocusTraversalPolicy
protected java.awt.Component before(java.awt.Component component)
Component
which might gain the focus. This
method searches recursively through the tree of Component
s, but
does not loop.component
- the currently focused Component
.Component
which might gain the focuspublic java.awt.Component getDefaultComponent(java.awt.Container container)
getDefaultComponent
in class java.awt.FocusTraversalPolicy
public java.awt.Component getFirstComponent(java.awt.Container container)
getFirstComponent
in class java.awt.FocusTraversalPolicy
public java.awt.Component getLastComponent(java.awt.Container container)
getLastComponent
in class java.awt.FocusTraversalPolicy
protected java.awt.Container getRootOrProvider(java.awt.Component component)
component
that is either
a focus cycle root
or
a policy provider
.component
- some componentnull
protected java.awt.FocusTraversalPolicy getFocusTraversalPolicy(java.awt.Container provider)
FocusTraversalPolicy
which should be used by
provider
. This method searches for a focus cycle root or
policy provider whose traversal policy is set
.provider
- a focus cycle root or policy provider whose
SimplifiedFocusTraversalPolicy
is searched.provider
or null