Hi Sergey,

On 06/10/2017 20:38, Sergey Bylokhov wrote:
On 10/6/17 09:53, Alexey Ivanov wrote:
It is limitation of our implementation:
https://bugs.openjdk.java.net/browse/JDK-8151385
http://mail.openjdk.java.net/pipermail/awt-dev/2016-March/010777.html

I see. And it can be changed, if deemed necessary, can't it?

Yes we can.

As far as I understand the bug above, it is possible that OS returns some other size.

No, it is not.
In that bug icons are extracted from Image List which is created a part of Toolbar:

1036     HWND hWndToolbar = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL,

Then an icon is extracted from that image list.
Obviously, Toolbar can create and creates, as the bug report shows, its icon set of different size depending on the current DPI setting, or rather the DPI settings of the main display.

As for JOptionPane, the icons are loaded using ::LoadIcon which loads icon of the default size only. Depending on the current DPI setting, it may return icon of larger size.


Yet in this fix, the file icon is requested with explicit size. You will get the size you requested.

Probably we have some other bug in the fix, but unfortunately I cannot confirm behavior you describe. For example if I request the icon for some pdf,java.txt files of size 100m then:
 - On HiDPI screen I get the native icon of size 64.
 - On LowDPI screen I get the native icon of size 32.
In both cases the user will get MRI, which will scale the native icon.

I tested it myself. For some reason, in some cases the icon looks crisp, in other cases it is scaled:

At 200% the icons look this way:

Icon    Java / JFileChooser     Paint / Open dialog
This PC                 
DPI shortcut            


In the second row, the icon is obviously correct because the small icon is flat.


Regards,
Alexey

Reply via email to