<AWT Dev> Review request for 8151385: [hidpi] JOptionPane-Icons only partially visible when using Windows 10 L&F

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Tue Mar 22 16:27:49 UTC 2016

On 3/22/2016 8:36 AM, Hendrik Schreiber wrote:
>> On Mar 21, 2016, at 22:07, Alexandr Scherbatiy 
>> <alexandr.scherbatiy at oracle.com 
>> <mailto:alexandr.scherbatiy at oracle.com>> wrote:
>> On 3/18/2016 6:09 AM, Hendrik Schreiber wrote:
>>> On Mar 16, 2016, at 06:25, Alexandr Scherbatiy 
>>> <alexandr.scherbatiy at oracle.com> wrote:
>>>>   The JDK fixes should be pushed to the JDK 9 first and then be 
>>>> back-ported to JDK 8.
>>>>   Could you prepare the fix for JDK 9?
>>> Hi Alexandr,
>>> I've created a patch for JDK9. You can find it at 
>>> http://cr.openjdk.java.net/~hschreiber/8151385/webrev.00/ (I hope, I 
>>> created the webrev the right way). It contains a suitable test.
>>> This patch also contains the changes I suggested in 
>>> https://bugs.openjdk.java.net/browse/JDK-8149453 (because the fixes 
>>> overlap to a degree). I made sure they compile, but didn’t do any 
>>> further testing (lack of time). Perhaps, since you are already 
>>> working on this, you can try it out and, if you deem it appropriate, 
>>> add a test for the upFolder/newFolder etc. buttons.
>>    For some reasons the native getIconBits() method returns size 16 
>> for both small and large icons which leads to the AOBE in the 
>> BufferedImage.setRGB() methods.
>>    I will try to investigate it deeper.
I got the IOBE running the simple JFileChooser (new 

I created an application in Visual Studio and try to check the returned 
icon size.
It returns the same size 16 for both IDB_VIEW_SMALL_COLOR and 

Here is the code which I used (without any error handling):

     int iconIndex = VIEW_NEWFOLDER;
     HWND hWndToolbar = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
         0, 0, 0, 0, 0,
         NULL, NULL, NULL, NULL);
     SendMessage(hWndToolbar, TB_LOADIMAGES, size, (LPARAM)HINST_COMMCTRL);
     HIMAGELIST hImageList = (HIMAGELIST)SendMessage(hWndToolbar, 

     HICON hIcon = ImageList_GetIcon(hImageList, iconIndex, 

     BITMAP bmp;
     memset(&bmp, 0, sizeof(BITMAP));

     ICONINFO iconInfo;
     GetIconInfo((HICON)hIcon, &iconInfo);
     HDC dc = GetDC(NULL);
     GetObject(iconInfo.hbmColor, sizeof(bmp), &bmp);

     wsprintf(str, L"Icon size: [%d, %d]", bmp.bmWidth, bmp.bmHeight);
     MessageBox(NULL, str, L"TEST", MB_OK);

  The other thing that I noticed that icons on JOptionPane have twice 
bigger size than expected.

> Thanks.
> -hendrik

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20160322/0a82ccdb/attachment-0001.html>

More information about the awt-dev mailing list