sbool activateFrame_windowsHack = true; sbool activateFrame(final Component c) { ret swing(func -> bool { Frame f = getAWTFrame(c); if (f == null) false; if (!f.isVisible()) f.setVisible(true); if (f.getState() == Frame.ICONIFIED) f.setState(Frame.NORMAL); // My glorious Windows hack // See: https://stackoverflow.com/questions/309023/how-to-bring-a-window-to-the-front if (activateFrame_windowsHack && isWindows()) { bool fullscreen = f.getExtendedState() == Frame.MAXIMIZED_BOTH; if (f.getExtendedState() != JFrame.ICONIFIED) { f.setExtendedState(JFrame.ICONIFIED); f.setExtendedState(fullscreen ? JFrame.MAXIMIZED_BOTH : JFrame.NORMAL); } } f.toFront(); true; }); }