Compiles but it is a bad programming practice because you use a Lock object as a monitor and javadoc of Lock class prevents it because generates confusion.
All dialogs are modal. Each showXxxDialog method blocks the
current thread until the user's interaction is complete.
However, if the current thread is the event dispatch thread, then it is
not blocked but sent to keep pumping events until the dialog is closed.
All dialogs are modal. Each showXxxDialog method blocks the current thread until the user's interaction is complete.