void (final AWTEvent event) { if (event instanceof FocusEvent fe) { final Component component = fe.getComponent(); if (component == null) return; if (!SwingUtilities.isDescendingFrom(component, myParent)) return; if (fe.getID() == FocusEvent.FOCUS_GAINED) { onFocusGained(fe); } else if (fe.getID() == FocusEvent.FOCUS_LAST) { onFocusLost(fe); } } }