void () { assert runner == null; myLog.setText(null); JFrame frame = getFrame(); Component c = WindowManager.getInstance().getFocusedComponent(frame); if (c == null) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(frame, true)); } else { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(c, true)); } SwingUtilities.invokeLater(() -> startWhenFrameActive()); }