I have a login frame that i have to wait for from another thread. Upon successful login frame disposes itself. And i want to pop up the main frame for the application. Right
What you really must understand with dealing with Swing (and in fact AWT), is that you need to keep all interaction with the components of the AWT Event Dispatch Thread (EDT).
So, do the login off the EDT. Use a new Thread, or better a java.util.concurrent.ExecutorService. When you discover that you have been logged in, use java.awt.EventQueue.invokeLater to get back onto the EDT. Anonymous inner class are great for capturing context and, despite their horrendously verbose syntax, making the code shorter.