/** * Recursively checks whether the specified component or one of its inner * components has focus. * * @param component * Component to check. * @return <code>true</code> if the specified component or one of its inner * components has focus, <code>false</code> otherwise. */ private static boolean isInFocusedWindow(Component component) { if (component == null) { return false; } // check if the component itself is focus owner if (component.isFocusOwner()) { return true; } // recursively find if has focus owner component if (component instanceof Container) { for (Component comp : ((Container) component).getComponents()) { if (isInFocusedWindow(comp)) { return true; } } } return false; }
/** * Recursively checks whether the specified component or one of its inner * components has focus. * * @param component * Component to check. * @return <code>true</code> if the specified component or one of its inner * components has focus, <code>false</code> otherwise. */ private static boolean isInFocusedWindow(Component component) { if (component == null) { return false; } // check if the component itself is focus owner if (component.isFocusOwner()) { return true; } // recursively find if has focus owner component if (component instanceof Container) { for (Component comp : ((Container) component).getComponents()) { if (isInFocusedWindow(comp)) { return true; } } } return false; }
.isInFocusedWindow(jButton.getTopLevelAncestor()); RootPaneDefaultButtonTracker tracker = trackers.get(jButton); if (!hasFocus) {
.isInFocusedWindow(jButton.getTopLevelAncestor()); RootPaneDefaultButtonTracker tracker = trackers.get(jButton); if (!hasFocus) {
trackers.remove(jButton); } else { if (!RootPaneDefaultButtonTracker.isInFocusedWindow(jButton .getTopLevelAncestor())) {
trackers.remove(jButton); } else { if (!RootPaneDefaultButtonTracker.isInFocusedWindow(jButton .getTopLevelAncestor())) {