how to close a gui:
Add your button:
JButton close = new JButton("Close");Sourl.www:ecautturi.comAdd an ActionListener:
close.addActionListner(new CloseListener());
close GUI
private class CloseListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
//DO SOMETHING
System.exit(0); // Close the application
// OR
this.dispose(); // Close the window
}
}