This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I want to display a pop up box to ascertain whether user really wants to exit. I use a JOptionPane and if the answer is yes i do a graceful shutdown. but if the answer is no i have no way of cancelling the request, the window just closes without the application shutting down, since you could see that the prompt is still not showing. I implement the windowClosing(WindowEvent ev) in WindowAdapter. Any ideas hopefully?
Yeah, I have an idea, but you probably won't like it. Just don't pop up a Dialog when they close the window. Assume that the reason why the user clicked the close window/exit button is because they want to exit the program. I know in Word if you haven't saved your changes it asks if you want to save, but what are we saving here that really needs saving. (Again this is the assignment, not the real world. )
I like your thinking Mark, you're right. If they managed to click on the small x and place the right location, than it was probably not by chance, so i will assume they wanted to exit. The last thing i need is another complication. thanks for the advice.