java - Swing on OSX: How to Trap command-Q? -


after being convinced ("schooled") swing apps on mac native, i'm trying make mine native possible. looks great, when hit command+q or menu, windowstatechanged(windowevent e) not firing on main jframe (if exit in other way, fire). how can respond real apple quit?

the top voted answer excellent fill in "best way":

system.setproperty("apple.eawt.quitstrategy", "close_all_windows"); 

this trigger standard window closing callback event should work nicely portable code.

as result of discussion below seems crucial in app. wrote in static initializer of main class before ui code executed.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -