You could bypass system.gui
entirely and directly use ErrorUtil
. Any of the overloads that accept a Component
first argument can be provided any arbitrary JComponent - in theory, providing a component/window/etc would tell Swing to open it on the correct monitor.
You could even bypass ErrorUtil
and directly call JOptionPane
methods yourself:
https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/JOptionPane.html#showConfirmDialog(java.awt.Component,java.lang.Object)