Hello all,
ive got a JFrame and right now i have it set to
frmMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
however i would like to run a function (cleanUp()) just before the
window closes, but only when its been notified that its been closed.
How would i go about doing that? Thanks!
Cheers,
Adam.
Betty - 07 May 2005 02:16 GMT
> Hello all,
>
[quoted text clipped - 8 lines]
> Cheers,
> Adam.
// trap window close and do something in an anonymous inner class
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
// your stuf here
System.exit(0);
}
});
balgach@gmail.com - 07 May 2005 02:35 GMT
ah i knew it was something simple, thanks!