void (@NotNull Container container, JComponent comp) { FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); if (policy != null) { Component prev = policy.getComponentBefore(container, comp); if (prev != null) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(prev, true)); } } }