Quit Behavior (specifically for Mac)

Jeremy Wood mickleness at gmail.com
Tue Feb 14 18:24:59 UTC 2023


A colleague and I are confused about how our Swing desktop app on Mac 
should exit.

(Please let me know if there’s a better forum to address this question 
to?)

In QuitHandler the documentation reads:

"Implementors must call either QuitResponse.cancelQuit() 
<https://docs.oracle.com/en/java/javase/19/docs/api/java.desktop/java/awt/desktop/QuitResponse.html#cancelQuit()>, 
QuitResponse.performQuit() 
<https://docs.oracle.com/en/java/javase/19/docs/api/java.desktop/java/awt/desktop/QuitResponse.html#performQuit()>, 
or ensure the application terminates.”

… but what if our application processes the request to terminate but 
does not “ensure the application terminates”?

For ex: suppose we initiate a series of user dialogs (“do you want to 
save your changes?”), but the user clicks “Cancel” to indicate they 
don’t want to proceed. So we are handling/consuming the quit request 
responsibly, but technically we haven’t done any of the 3 actions we 
“must” do.

Is this acceptable? (and if so: should we have a ticket to reword the 
QuitHandler documentation?)

Or if it is not acceptable: what bad side-effects should we know to test 
for?

Regards,
  - Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20230214/f19254b1/attachment.htm>


More information about the client-libs-dev mailing list