No exit option if something is running
- by max
How can I catch something going on if the user chooses the exit option from a menu?
I mean I'd like to be able to manage the event of a user who is going to close the application
but some activity is being performed so he/she shouldn't be able to exit.
Here's the code I wrote.
In a nutshell :
recording is being performed -- user clicks exit -- WARNING "Process is running you can't do it"(The process goes on)
nothing is running -- user clicks exit -- application closes
Is it possible to solve the problem by just adding a few lines of code without having to rewrite the
entire program?
thanks very much in advance.
MAX
exitAction = new AbstractAction("Exit") {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
};
exitAction.putValue(Action.NAME, "Exit");
// description
exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit application");