Suppose your previous frame is myPreviousFrame
just write myPreviousFrame.setVisible(true);
when you want to make visible.
Example:
currentFrame.dispose();
myPreviousFrame.setVisible(true);
Note: if you write code System.exit(0)
it will close (terminate) your application. When your application goes terminate you can not make login frame as visible. You need to restart your application. So you need to write dispose()
.
UPDATED:
I suppose you have a method exitForm()
which invokes when you click the Close (X).
Example:
private void exitForm(java.awt.event.WindowEvent evt) {
//System.exit(0); which was used
// to fullfill your requirement you need to write below code
this.dispose();// here [this] keyword means your current frame
//OR simply you can use this.setVisible(false); instead of this.dispose();
myPreviousFrame.setVisible(true); // this will displays your login frame
}