Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7148275

[macosx] setIconImages() not working correctly (distorted icon when minimized)

    Details

    • Subcomponent:
    • Resolved In Build:
      b18
    • CPU:
      x86
    • OS:
      os_x
    • Verification:
      Verified

      Backports

        Description

        https://www.netbeans.org/bugzilla/show_bug.cgi?id=208744

        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

        http://bugzilla-attachments-208744.netbeans.org/bugzilla/attachment.cgi?id=116017

        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.

          Issue Links

            Activity

            Hide
            anthony Anthony Petrov (Inactive) added a comment -
            BT2: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.
            Show
            anthony Anthony Petrov (Inactive) added a comment - BT2: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.
            Hide
            anthony Anthony Petrov (Inactive) added a comment -
            BT2: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.
            Show
            anthony Anthony Petrov (Inactive) added a comment - BT2: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.
            Hide
            anthony Anthony Petrov (Inactive) added a comment -
            BT2:EVALUATION

            CPlatformWindow.getImageForTarget() must walk through images to choose the largest one.
            Show
            anthony Anthony Petrov (Inactive) added a comment - BT2:EVALUATION CPlatformWindow.getImageForTarget() must walk through images to choose the largest one.
            Hide
            anthony Anthony Petrov (Inactive) added a comment -
            BT2: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);
                 }
            Show
            anthony Anthony Petrov (Inactive) added a comment - BT2: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);      }

              People

              • Assignee:
                anthony Anthony Petrov (Inactive)
                Reporter:
                anebuzel Antonín Nebuželský
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: