I seem to do nothing but post about native title bar support. Anyhow, I added support for command-W and option-command-W to my app; here’s how I handled it if anyone cares. This is from the keyPressed handler for my window class:
[code] ModifierKeys mods;
mods = key.getModifiers();
//
// Look for option-command-w
//
// I have no idea where the magic key code 183 came from, but that's what you get
//
if (key.isKeyCode(183) && mods.isCommandDown() && mods.isAltDown())
{
// do something to close all your application's windows at once here
return;
}
//
// Look for command-w
//
if (key.isKeyCode('w') && (mods.isCommandDown()))
{
closeButtonPressed();
return;
}
[/code]