'intercepting' windowClosing event
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mark_webb
Posted On:   Tuesday, May 14, 2002 08:57 AM

Is there a way to not have either a JFrame or a JDialog close when the X is clicked on the upper right of the window. If the user of my program clicks the X, even if I ask them if they want to close and they say no, the window still closes.

Re: 'intercepting' windowClosing event

Posted By:   Mike_Asmar  
Posted On:   Tuesday, May 14, 2002 01:14 PM

In your JDialog you can do something with the processWindowEvent like this

protected void processWindowEvent(WindowEvent e)

{

if (e.getID() == e.WINDOW_CLOSING) {




if you want it to close out the window then just do a


super.processWindowEvent(e);


when you are done otherwise, just return and your dialog won't close.


-Mike A.
About | Sitemap | Contact