Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5286
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.gui |
| Subject | Re: Outside of the EDT: JOptionPane.showMessageDialog |
| Date | 2012-12-27 10:23 -0500 |
| Organization | The Wasteland |
| Message-ID | <nospam-D5E268.10234727122012@news.aioe.org> (permalink) |
| References | <EDT-20121227033249@ram.dialup.fu-berlin.de> <kbgoak$ass$1@dont-email.me> <showMessageDialog-20121227071317@ram.dialup.fu-berlin.de> |
In article <showMessageDialog-20121227071317@ram.dialup.fu-berlin.de>, ram@zedat.fu-berlin.de (Stefan Ram) wrote: > Knute Johnson <nospam@knutejohnson.com> writes: > > I looked at the source for JOptionPane and I don't see > > anything in there that would lead me to believe that you > > could invoke it safely on other than the EDT. > > Possibly it's the way they are called, in a sequential > manner without any callbacks. When the application invokes > showMessageDialog, there is no Swing component yet, the > application waits synchronously until after the end of > execution of showMessageDialog, when again there is no Swing > component anymore. So, during the runtime of > showMessageDialog, Swing has exclusive control. Maybe this > suffices to prevent any problems with multithreading? I'd say no. If the dialog is not constructed on the EDT, then it is constructed on some other thread, e.g. the initial thread. At any point, the construction of a component of the dialog or the Object(s) referenced in the message parameter may result in a Runnable being posted to the EDT, which is started with the first invocation of postEvent(). This results in a race between the (initial) thread and the EDT. Proving the absence of a problem for a particular case would have to rely on (undocumented) implementation details. -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Outside of the EDT: JOptionPane.showMessageDialog Knute Johnson <nospam@knutejohnson.com> - 2012-12-26 22:03 -0800
Re: Outside of the EDT: JOptionPane.showMessageDialog "John B. Matthews" <nospam@nospam.invalid> - 2012-12-27 10:23 -0500
Re: Outside of the EDT: JOptionPane.showMessageDialog Knute Johnson <nospam@knutejohnson.com> - 2012-12-27 09:06 -0800
Re: Outside of the EDT: JOptionPane.showMessageDialog "John B. Matthews" <nospam@nospam.invalid> - 2012-12-27 16:16 -0500
Re: Outside of the EDT: JOptionPane.showMessageDialog "John B. Matthews" <nospam@nospam.invalid> - 2012-12-27 16:34 -0500
Re: Outside of the EDT: JOptionPane.showMessageDialog "John B. Matthews" <nospam@nospam.invalid> - 2012-12-29 10:38 -0500
Re: Outside of the EDT: JOptionPane.showMessageDialog Lew <lewbloch@gmail.com> - 2012-12-31 12:00 -0800
csiph-web