A couple of years ago, when java was still a thing, I wrote myself a small diagram editing program in Swing. I still use it, but I'm trying to transition to various other codebases. When I close the window, or select the window's Quit Menu item, it's supposed to ask me to confirm. When I press cmd-quit, or select quit from the macintosh menu bar, it immediately terminates, and periodically, I lose what I've been working on that way. Is there a way to trap cmd-q?