score:0

The default behavior of a JFrame when closing is HIDE_ON_CLOSE which does specifically what it says. That's why your event isn't getting fired : because the window isn't really closed. You can deal with this by changing the default closing behavior of your frame with :

frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE)

You can also change your event with windowClosing. See java doc :

Invoked when the user attempts to close the window from the window's system menu.

Or you can simply get rid of your listener and add :

frame.setDefaultCloseOperation(EXIT_ON_CLOSE)

Related Query

More Query from same tag