Java examples for Swing:JFrame
Disabling the Close Button on a JFrame
import javax.swing.JFrame; public class Main { public static void main(String[] args) throws Exception { JFrame frame = new JFrame(); // Get default close operation int op = frame.getDefaultCloseOperation(); // HIDE_ON_CLOSE // Set to ignore the button frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); }/*from w w w. j a va2s . co m*/ }