Mercurial > hg > release > icedtea7-forest-2.2 > jdk
changeset 5101:93eda4253911
7148275: [macosx] setIconImages() not working correctly (distorted icon when minimized)
Summary: Choose the largest icon from a list of icons provided by user
Reviewed-by: swingler
author | anthony |
---|---|
date | Wed, 14 Mar 2012 07:03:51 +0400 |
parents | a2fe76236162 |
children | 4c592e287e7d |
files | src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Mar 12 16:02:37 2012 -0700 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Mar 14 07:03:51 2012 +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); }