Java swing. How to wait for other Jframes

awt, java, swing, user-interface

Solution

Just use a modal dialog in stead of a frame, that way you cannot do anything else until it'is closed

see http://mindprod.com/jgloss/modal.html for explanation and see http://www.java2s.com/Tutorial/Java/0240__Swing/ASimpleModalDialog.htm for code example

If you insist on using a JFrame, you could use a workaround by cover the other frame by a glassframe.. Not too a nice solution, I admit..

Problem

In a JFrame, when I click on 'login', I pop up another Jframe which is the login window. How do I make my main Jframe wait for my login Jframe to exit, before doing anything else?

Original source