void (final @NotNull @NlsContexts.PopupContent String message, final MessageType type) { Runnable runnable = () -> { Window[] windows = Window.getWindows(); Window targetWindow = null; for (Window each : windows) { if (each.isActive()) { targetWindow = each; break; } } if (targetWindow == null) { targetWindow = JOptionPane.getRootFrame(); } showBalloonForComponent(targetWindow, message, type, true, null); }; UIUtil.invokeLaterIfNeeded(runnable); }