I seem to have the reverse problem to most people. I have the following pretty standard code to see if the user wants to do some saves before closing the window:
This is the key, methinks: frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); Makes the difference in the test case I cooked up.
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);