JDK-7148275 : [macosx] setIconImages() not working correctly (distorted icon when minimized)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-02-23
  • Updated: 2017-05-24
  • Resolved: 2012-04-05
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 Other
7u4 b18Fixed 8Fixed openjdk7uFixed
Related Reports
Relates :  

NetBeans icon, when the running application is minimized into Mac's panel, is distorted into low resolution as can be seen in the screenshot at


NetBeans is using -Xdock:icon=$progdir/../nb/netbeans.icns startup parameter which works correctly with previous versions of Java on Mac. With 7u4 the provided icon is not used correctly by Java.

EVALUATION CPlatformWindow.getImageForTarget() must walk through images to choose the largest one.

SUGGESTED FIX --- old/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java 2012-03-08 20:14:57.000000000 +0400 +++ new/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java 2012-03-08 20:14:56.000000000 +0400 @@ -725,9 +725,17 @@ return null; } - // TODO: need a walk-through to find the best image. - // The best mean with higher resolution. Otherwise an icon looks bad. - final Image image = icons.get(0); + // Choose the best (largest) image + Image image = icons.get(0); + // Assume images are square, so check their widths only + int width = image.getWidth(null); + for (Image img : icons) { + final int w = img.getWidth(null); + if (w > width) { + image = img; + width = w; + } + } return CImage.getCreator().createFromImage(image); }

EVALUATION -Xdock:icon has nothing to do with the representation of minimized windows in the dock. The icon for a minimized window is specified with the Window.setIconImages() API.

EVALUATION The problem is reproducible. Note that even with Apple JDK the minimized icon is slightly worse in quality comparing to the running app icon. However, with Oracle JDK 7u4 the minimized icon looks very low-quality.