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()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
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
-