标签:order example def board next lsp span aci rev
public Component findNextFocus() { // Find focus owner Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); Container root = c == null ? null : c.getFocusCycleRootAncestor(); if (root != null) { FocusTraversalPolicy policy = root.getFocusTraversalPolicy(); Component nextFocus = policy.getComponentAfter(root, c); if (nextFocus == null) { nextFocus = policy.getDefaultComponent(root); } return nextFocus; } return null; } public Component findPrevFocus() { // Find focus owner Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); Container root = c == null ? null : c.getFocusCycleRootAncestor(); if (root != null) { FocusTraversalPolicy policy = root.getFocusTraversalPolicy(); Component prevFocus = policy.getComponentBefore(root, c); if (prevFocus == null) { prevFocus = policy.getDefaultComponent(root); } return prevFocus; } return null; }
Related Examples |
e615. Finding the Next Focusable Component
标签:order example def board next lsp span aci rev
原文地址:https://www.cnblogs.com/borter/p/9596086.html