Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+15 votes

On our map editor class, we made a close button and assigned it to show the confirmation alert (that makes sure if user wants to save or discard the project) when clicked and behave accordingly. However, I don't know how to make confirmation alert to pop up when a user clicks exit button(the red x to close the window on top).

asked in CSC305 Fall 2022 by (1 point)

1 Answer

+6 votes

I used the setOnCloseRequest which uses an event handler to handle what happens if their is an external request to close the window(clicking the exit button).

answered by (1 point)