boolean (@NotNull Component component) { if (GraphicsEnvironment.isHeadless()) { return true; } JComponent jComponent = component instanceof JComponent ? (JComponent)component : null; return jComponent != null && Boolean.TRUE.equals(jComponent.getClientProperty(HAS_FOCUS)); }