I added an window state listener as follow:
this.addWindowStateListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
ExitAction.getInstance().actionPerformed(null);
}
});
But when I'm using the X close button the event is not called. I think it's something to do with netbean jdesktop framework. But I can't find what could be the problem. Thanks for your help.