void (final FocusEvent e) { final Component component = e.getComponent(); if (e.isTemporary() || !component.isShowing()) { return; } if (component instanceof JTextComponent && ((JTextComponent)component).isEditable()) { SwingUndoUtil.addUndoRedoActions((JTextComponent)component); } setFocusedComponentImpl(component, e); setNearestFocusableComponent(component.getParent()); }