1

I created a Modal Dialog by extending JDialog. As soon as setVisible(true) gets called code flow gets stuck at that point until the dialog gets dispose (as per expectation).

However i do not know/understand what happens to all the events already scheduled by using SwingUtilites.invokeLater(), does these events also get hold up until modal dialog closes or they are independent and do get executed when the modal dialog is still open ?

Thanks in advance.

Sanjeev
  • 9,876
  • 2
  • 22
  • 33
  • 2
    You will be blocking the ongoing processing of the current event at that point, but a secondary event loop will process the subsequent events. See [this answer](https://stackoverflow.com/a/41511714/2711488) which explains it by discussing a problem caused by this behavior. – Holger Nov 14 '19 at 09:25
  • @Holger secondary event loop starts working on the next event from same event queue until primary finishes with Modal Dialog ? – Sanjeev Nov 14 '19 at 11:30
  • The primary loop doesn’t make progress as long as it is blocked in `setVisible(true)`. The dialog will be closed as a reaction of an event processed by the secondary loop (window close button, escape key, or whatever). – Holger Nov 14 '19 at 11:42
  • Thanks @Holger, Please put it as an answer and i shall accept it :) – Sanjeev Nov 14 '19 at 12:29

0 Answers0