title: Handling exit button which is create automatically?
body: <p>I am building a text editor and I don't know how to handle a listener on Swing exit button, which is create automatically.
  I want to use dialogs  when user doesn't save file, for example press exit button.    </p>