quit application while closing a JFrame
Normally, by activating the „x“-button of the frame, the application is only hidden but not closed. But you can change this by means of the following instruction:
JFrame frame = new ... frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);