From: Ben Soares Date: Mon, 13 Jun 2022 17:32:22 +0000 (+0100) Subject: JAL-1988 Hack to ensure Quit dialog box is moved to front X-Git-Tag: Release_2_11_2_6~44^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1d89624071d35163b979b55a10b8bf8d58370d69;p=jalview.git JAL-1988 Hack to ensure Quit dialog box is moved to front --- diff --git a/src/jalview/jbgui/APQHandlers.java b/src/jalview/jbgui/APQHandlers.java index 27c53b9..e18ec44 100644 --- a/src/jalview/jbgui/APQHandlers.java +++ b/src/jalview/jbgui/APQHandlers.java @@ -20,11 +20,11 @@ */ package jalview.jbgui; +import javax.swing.JFrame; import javax.swing.JOptionPane; import com.formdev.flatlaf.extras.FlatDesktop; -import jalview.gui.Desktop; import jalview.util.MessageManager; public class APQHandlers @@ -46,11 +46,26 @@ public class APQHandlers int n; if (confirmQuit) { - n = JOptionPane.showConfirmDialog(null, + // ensure Jalview window is brought to front for Quit confirmation + // window to be + // visible + + // this method of raising the Jalview window is broken in java + // jalviewDesktop.setVisible(true); + // jalviewDesktop.toFront(); + + // a better hack which works instead + JFrame dialogParent = new JFrame(); + dialogParent.setAlwaysOnTop(true); + + n = JOptionPane.showConfirmDialog(dialogParent, MessageManager.getString("label.quit_jalview"), MessageManager.getString("action.quit"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); + + dialogParent.setAlwaysOnTop(false); + dialogParent.dispose(); } else {