Mike Swingler <###@###.###>:
I think the problem is that JDK7's top level windows are actually NSPanels, not NSWindows. This is so custom style bits can be applied to them (like titlebar-less, utility or HUD). Further work would need to be done to create an NSWindow subclass and an NSPanel subclass that could be dynamically changed at runtime to support "elevating" a window to a new style (and subsequently loosing it's name in the default Window menu - as it should) - but from Java's perspective, that should amount to a re-parenting operation.
You can switch the superclass to NSWindow, but I think that will have unexpected consequences for untitled windows. If it doesn't, that only means you lose the extended styles like utility and HUD, which may be a reasonable tradeoff for getting the window title names in the Dock (but not in the main menu bar).
Scott Kovatch <###@###.###>:
>> All you need to do is have a menu named 'Window' in the nib file, and Cocoa will take care of updating it with all of the open windows, and adding it to the dock icon. The window has to have a title, I believe. That's how it used to work, anyway.
>> >> Aren't we using the shared DefaultApp.nib?
> > That isn't the problem (well, it's a problem, but not related to the Dock window menu). The default NIB has never had a Window menu because developers often add one themselves, and then there is two. We've lived without that from Java 1.3 to 1.6, and have only gotten a few bugs along the lines of "I can't create the dashes and diamonds in the real Window menu"...so people clearly want to be HIG compliant, but it hasn't seemed to occur to them that we should be doing it for them. I'd love to see a "use the platform Window menu" in the menu bar.
Double-check DefaultApp.nib. There should be a free-floating NSMenu instance in there with a title of Window (or maybe a name of 'Window', I don't recall.) It's not added to the default menu bar. It's been there since 1.4.2 or so, unless someone took it out after I added it. :-)
This isn't about adding a Window menu to the menu bar -- there's no way the AWT can handle that in an HIG-compliant way.
As soon as I use the NSWindow class as a super class for AWT windows, they do appear in the dock icon menu. Given that the type of a window is set before creating a peer, we may have two implementations: one for NORMAL windows, and another, NSPanel-based, for UTILITY/undecorated windows.