boolean (Component c) { if (c.hasFocus()) return true; if (c instanceof JSpinner spinner) { if (spinner.getEditor() != null) { synchronized (spinner.getEditor().getTreeLock()) { return spinner.getEditor().getComponent(0).hasFocus(); } } } return false; }