Logout functionality using JAVA Swing

I have developed a login form. I'm able to login to another frame after validating my login credentials. In that frame, there is a button that i want to develop so that it will logout from the current frame and go back to the initial login frame. I want to know how to implement it?