If you have a panel/frame with a JButton on it.
And when it is clicked it will close the whole program.
To do this as said by other poster you need to use the System.exit(0);
It will idd close...