i wan to close the particular classname.java window alone.

I am developing a GUI using netbeans.
I created a main class and defined a button , when clicked will load 
new classname().setVisible(true);

this classname.java contains a frame with components to get the input

now when i use System.exit(); in classname.java all the windows are closed

i wan to close the particular classname.java window alone.
how can i do so ?

```
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
   System.exit(0); // TODO add your handling code here:
}

```