Hi,
I am trying to do the following:
1) Disable all the events when the [X] button is clicked on it, i.e. no operation for the close button.
2) But when user closes it through Ctrl+Alt+Del and ending the program (not the process), I have to catch the event.
I have made the default close operation to
and enabled the events
Now I could catch the Ctrl+Alt+Del close event, but when I clicked the [X] button, my application is getting closed and the Window Closing event is caught.
Can you guide me in finding out the correct procedure for handling it.
Thanks,
-M
I am trying to do the following:
1) Disable all the events when the [X] button is clicked on it, i.e. no operation for the close button.
2) But when user closes it through Ctrl+Alt+Del and ending the program (not the process), I have to catch the event.
I have made the default close operation to
Code:
this.setDefaultCloseOperation( this.DO_NOTHING_ON_CLOSE );
and enabled the events
Code:
enableEvents( AWTEvent.WINDOW_EVENT_MASK );
Code:
protected void processWindowEvent( WindowEvent e )
{
super.processWindowEvent( e );
if ( e.getID() == WindowEvent.WINDOW_CLOSING ) {
//I have written the code for handling event here
}
}
Now I could catch the Ctrl+Alt+Del close event, but when I clicked the [X] button, my application is getting closed and the Window Closing event is caught.
Can you guide me in finding out the correct procedure for handling it.
Thanks,
-M