Class LayoutFocusTraversalPolicy
- All Implemented Interfaces:
Serializable
ComponentOrientation for more information. All columns in a
row are fully traversed before proceeding to the next row.- Since:
- 1.4
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDetermines whether the specifiedComponentis an acceptable choice as the new focus owner.getComponentAfter(Container aContainer, Component aComponent) Returns the Component that should receive the focus after aComponent. aContainer must be a focus cycle root of aComponent.getComponentBefore(Container aContainer, Component aComponent) Returns the Component that should receive the focus before aComponent. aContainer must be a focus cycle root of aComponent.getFirstComponent(Container aContainer) Returns the first Component in the traversal cycle.getLastComponent(Container aContainer) Returns the last Component in the traversal cycle.Methods declared in class SortingFocusTraversalPolicy
getComparator, getDefaultComponent, getImplicitDownCycleTraversal, setComparator, setImplicitDownCycleTraversalModifier and TypeMethodDescriptionprotected Comparator<? super Component> Returns the Comparator which will be used to sort the Components in a focus traversal cycle.getDefaultComponent(Container aContainer) Returns the default Component to focus.booleanReturns whether this SortingFocusTraversalPolicy transfers focus down- cycle implicitly.protected voidsetComparator(Comparator<? super Component> comparator) Sets the Comparator which will be used to sort the Components in a focus traversal cycle.voidsetImplicitDownCycleTraversal(boolean implicitDownCycleTraversal) Sets whether this SortingFocusTraversalPolicy transfers focus down-cycle implicitly.Methods declared in class InternalFrameFocusTraversalPolicy
getInitialComponentModifier and TypeMethodDescriptionReturns the Component that should receive the focus when a JInternalFrame is selected for the first time.Methods declared in class FocusTraversalPolicy
getInitialComponentModifier and TypeMethodDescriptiongetInitialComponent(Window window) Returns the Component that should receive the focus when a Window is made visible for the first time.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
LayoutFocusTraversalPolicy
public LayoutFocusTraversalPolicy()Constructs a LayoutFocusTraversalPolicy.
-
-
Method Details
-
getComponentAfter
Returns the Component that should receive the focus after aComponent. aContainer must be a focus cycle root of aComponent.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
setImplicitDownCycleTraversalmethod.If aContainer is focus traversal policy provider, the focus is always transferred down-cycle.
- Overrides:
getComponentAfterin classSortingFocusTraversalPolicy- Parameters:
aContainer- a focus cycle root of aComponent or a focus traversal policy provideraComponent- 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- if aContainer is not a focus cycle root of aComponent or a focus traversal policy provider, or if either aContainer or aComponent is null
-
getComponentBefore
Returns the Component that should receive the focus before aComponent. aContainer must be a focus cycle root of aComponent.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
setImplicitDownCycleTraversalmethod.If aContainer is focus traversal policy provider, the focus is always transferred down-cycle.
- Overrides:
getComponentBeforein classSortingFocusTraversalPolicy- Parameters:
aContainer- a focus cycle root of aComponent or a focus traversal policy provideraComponent- 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- if aContainer is not a focus cycle root of aComponent or a focus traversal policy provider, or if either aContainer or aComponent is null
-
getFirstComponent
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.- Overrides:
getFirstComponentin classSortingFocusTraversalPolicy- Parameters:
aContainer- a focus cycle root of aComponent or a 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- if aContainer is null
-
getLastComponent
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.- Overrides:
getLastComponentin classSortingFocusTraversalPolicy- Parameters:
aContainer- a focus cycle root of aComponent or a 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- if aContainer is null
-
accept
Determines whether the specifiedComponentis an acceptable choice as the new focus owner. This method performs the following sequence of operations:- Checks whether
aComponentis visible, displayable, enabled, and focusable. If any of these properties isfalse, this method returnsfalse. - If
aComponentis an instance ofJTable, returnstrue. - If
aComponentis an instance ofJComboBox, then returns the value ofaComponent.getUI().isFocusTraversable(aComponent). - If
aComponentis aJComponentwith aJComponent.WHEN_FOCUSEDInputMapthat is neithernullnor empty, returnstrue. - Returns the value of
DefaultFocusTraversalPolicy.accept(aComponent).
- Overrides:
acceptin classSortingFocusTraversalPolicy- Parameters:
aComponent- theComponentwhose fitness as a focus owner is to be tested- Returns:
trueifaComponentis a valid choice for a focus owner; otherwisefalse- See Also:
- Checks whether
-