exit button in javaswing code example
Example 1: jbutton close jframe java
private void btnButtonActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
Example 2: how to close a jframe in netbeans
JFrame1.dispose(); //Remove JFrame 1
JFrame2.setVisible(true) //Show other frame