From: Marcin Rodzik on
On May 7, 6:25 pm, "John B. Matthews" <nos...(a)nospam.invalid> wrote:
> > I know dialogs are event-driven so that execution of the thread which
> > requested displaying the dialog stops, but other currently fired
> > events are still handled.
>
> Perhaps I misunderstand, but this seems incorrect. A modal dialog
> blocks the caller's ability to post new user generated events to the
> (.....)

Probably, what I said was ambiguous, but I didn't mean the EDT stops.
Indeed, it continues processing events. However, as far as I know, the
method which calls JDialog stops because the JOptionPane.showXxxDialog
methods don't usually return until the user presses some button, or
something. Am I right?

Anyway, thanks for *all* your answers. Now I know everything [I need]

MR
From: John B. Matthews on
In article
<25913809-e9cd-4bc2-8de7-0db4b47d254c(a)l28g2000yqd.googlegroups.com>,
Marcin Rodzik <marteno_rodia(a)o2.pl> wrote:

> On May 7, 6:25 pm, "John B. Matthews" <nos...(a)nospam.invalid> wrote:
> > > I know dialogs are event-driven so that execution of the thread
> > > which requested displaying the dialog stops, but other currently
> > > fired events are still handled.
> >
> > Perhaps I misunderstand, but this seems incorrect. A modal dialog
> > blocks the caller's ability to post new user generated events to
> > the (.....)
>
> Probably, what I said was ambiguous, but I didn't mean the EDT stops.
> Indeed, it continues processing events. However, as far as I know,
> the method which calls JDialog stops because the JOptionPane.
> showXxxDialog methods don't usually return until the user presses
> some button, or something. Am I right?

Yes. The showXxxDialog() methods invoke show(), now deprecated, which
clarifies "It is permissible to show modal dialogs from the event
dispatching thread because the toolkit will ensure that another event
pump runs while the one which invoked this method is blocked."

> Anyway, thanks for *all* your answers. Now I know everything [I need]

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: markspace on
John B. Matthews wrote:
>
> Yes. The showXxxDialog() methods invoke show(), now deprecated, which
> clarifies "It is permissible to show modal dialogs from the event
> dispatching thread because the toolkit will ensure that another event
> pump runs while the one which invoked this method is blocked."


Also, the JDialog docs clearly state that JDialog is not thread safe.
Even though show() is an AWT method, the JDialog object is still
accessed on the EDT and therefore must be used in a thread-safe manner.

Call ALL of it's methods on the EDT only. show() has no documented
exception to this rule.