How can save some Objects, directly after the User has closed the Applications JFrame, but before the Program exits?

后端 未结 1 1150

Good day!

I\'m developping a small Java Application with NetBeans IDE that extends JFrame. I implemented several ways to close the App, for example pressing Ctrl-Q

相关标签:
1条回答
  • 2021-01-22 22:43
    1. setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE )
    2. Add a WindowListener or WindowAdapter - overriding either the windowClosing() or windowClosed() methods (I forget which) to catch the closing event.
    3. Call the save functionality from the window method.
    4. Call setVisible(false) or dispose() (as discussed in the comments) at the end.
    0 讨论(0)
提交回复
热议问题