Here's a short code that might help.
<yourJFrameName> main = new <yourJFrameName>();
main.setVisible(true);
this.dispose();
where...
main.setVisible(true);
will run the JFrame again.
this.dispose();
will terminate the running window.