JDK-7124513 : [macosx] Support NSTexturedBackgroundWindowMask/different titlebar styles to create unified toolbar
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2011-12-23
  • Updated: 2014-10-09
  • Resolved: 2012-07-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b49Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
http://java.net/jira/browse/MACOSX_PORT-764 submitted 2011/12/02 by Hendrik Schreiber
For probably more than half a decade most attractive native applications on OS X have been using the unified toolbar look available through the NSWindow style NSTexturedBackgroundWindowMask. Because the title bar of Windows (e.g. JFrame) is painted by AWT/Swing, it is very hard for developers to achieve this look.
Java 6 SE for OS X honored the property <span class=&quot;nobr&quot;><a href=&quot;http://developer.apple.com/library/mac/#technotes/tn2007/tn2196.html#APPLE_AWT_BRUSHMETALLOOK&quot;>http://developer.apple.com/library/mac/#technotes/tn2007/tn2196.html#APPLE_AWT_BRUSHMETALLOOK<sup><img class=&quot;rendericon&quot; src=&quot;/jira/images/icons/linkext7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/></sup></a></span> and essentially rendered the desired background and titlebar. Unfortunately, its implementation is apparently less than perfect (see <span class=&quot;nobr&quot;><a href=&quot;http://lists.apple.com/archives/java-dev/2011/Nov/msg00033.html&quot;>http://lists.apple.com/archives/java-dev/2011/Nov/msg00033.html<sup><img class=&quot;rendericon&quot; src=&quot;/jira/images/icons/linkext7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/></sup></a></span>).
To compete with native applications on OS X, Java applications have to be able to emulate their looks. This is impossible without the unified toolbar. The biggest obstacle to implementing a unified toolbar is the titlebar style - by default it has a thin line at the bottom. There should be a way to switch this to another style that does not have that line and can be connected seamlessly to an adjacent toolbar.
Since most Mac user's value an appealing (if not sexy) UI, for all of us who try to ship commercial software for OS X based on Java, this is a showstopper for adopting OpenJDK.
Additionally, but this is not as important, it would be nice, if there was a way to specify a style for JPanels that filled them with the system's native pattern (gray gradient for Snow Leopard, gradient with noise for Lion).

Comments
Testcase was added in JDK-8029010
29-11-2013

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/80c592c9458e
14-08-2012

SUGGESTED FIX http://cr.openjdk.java.net/~serb/7124513/webrev.01/
04-07-2012

EVALUATION Author: Mike Swingler Date: 02/Dec/11 09:53 PM The fundamental crux of this problem is that the background must be drawn by AppKit on thread 0 (most likely into the underlying window back buffer). The means that the Java content must either evade drawing their own background, or draw with a background color that is pure transparent in a SRC instead of SRC_OVER mode, so that the underlying window texture can show through. Author: Hendrik Schreiber Date: 03/Dec/11 10:27 AM No offense, but I don't think the textured background in the content pane ever really worked all the way in Java 6. In my (Java6) code I resorted to painting all the backgrounds myself instead of using non-opaque components to let the original background shine through. That way I could be sure things looked the way I wanted them to look. However, it's different with the titlebar - it's simply much harder (if not impossible) to get to as a regular developer. So a first step, to make it at all possible to have a nice looking app, would be to deal with the titlebar and ignore the content pane background issues. Or just paint the background in a plain gray that matches the bottom color of the titlebar.
23-12-2011