What\'s the correct way to get a JFrame to close, the same as if the user had hit the X close button, or pressed Alt+F4 (on W
JFrame
X
Here would be your options:
System.exit(0); // stop program frame.dispose(); // close window frame.setVisible(false); // hide window