From: Andreas Leitgeb on
Some application "A" uses a class derived from
org.jdesktop.application.Task.InputBlocker

In the subclass it creates a (modal) JDialog by means of
JOptionPane.createDialog() (and dlg.setModal(true)) to allow
the user to cancel some running task.

Going busy with such a busy-dialog up may happen even without *immediately*
preceding interaction (but nevertheless principially expected by the user).
IOW., by the time the busy-dialog is shown, the user may have switched to
another application and use that.

Strangely, it depends on the applicaton the user then works at, whether
or not on going busy application "A" also comes to the foreground and
commits focus-theft (which it never really should.)

If user works on MS Outlook, then the busy-dialog comes to front, if
instead the user currently uses MS Word then the busy-dialog remains in the
back, until it is explicitly activated.

I was quite surprised about this dependency on currently active app, and
would like to know both, the reasons for this difference, and also how
to make the busy-dialog stay in the back even if MS Outlook is at the front.

It might sound weird, and it is. To make it really clear I describe two
scenarios: for simplicity, assume that app "A" enters busy-mode
one minute after some interaction "I" (this "one minute delay" is
just for the sake of simplification of this post, so please don't let
that sidetrack you.)

start "A" then do action "I" then open MS Word and type a text.
then a minute after interaction "I", the busy-dialog shows as a
blinking icon in the taskbar, and MS Word remains the active application.

start "A" then do action "I" then open MS Outlook and read or compose a mail.
then a minute after interaction "I", the busy-dialog pops up to front,
together with app "A"'s main window, and steals the focus from Outlook.

I'd like app "A" to behave with MS Oulook, just like it already behaves
with MS Word - or at least understand the difference between Outlook and
Word with respect to an Java-application's JDialog pop up behaviour...