JFrame Disposal
JFrame allows you to configure how it responds to closure.
- Default: hides JFrame on closure attempt.
- To modify: invoke setDefaultCloseOperation().
- E.g.,:
-
MyJFrameInstance.setDefaultCloseOperation (WindowConstants.DO_NOTHING_ON_CLOSE);
/* behaves just like java.awt.Frame */
- other constants in javax.swing.WindowConstants:
- HIDE_ON_CLOSE - invokes any registered WindowListener objects, then hides. This is default behavior.
- DISPOSE_ON_CLOSE - invokes any reguster WindowListener objects, and then disposes.