Mega Code Archive

 
Categories / Java / Swing JFC
 

Define the default close operation of a JFrame to EXIT_ON_CLOSE, application will exit by calling System exit()

import javax.swing.JFrame; public class Main extends JFrame {   public static void main(String[] args) {     Main frame = new Main();     frame.setSize(100, 100);     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     frame.setVisible(true);   } }