the code for close the jfarme in netbeans code example
Example: how to close a jframe in netbeans
JFrame1.dispose(); //Remove JFrame 1
JFrame2.setVisible(true) //Show other frame
JFrame1.dispose(); //Remove JFrame 1
JFrame2.setVisible(true) //Show other frame