<AWT Dev> RFR: 8182043: Access to Windows Large Icons [v4]

Alexey Ivanov aivanov at openjdk.java.net
Fri May 14 13:44:38 UTC 2021

On Tue, 11 May 2021 21:34:59 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

>> No, it isn't wrapped: if `getShell32Icon` is called in `getIcon(final boolean getLargeIcon)`, the returned value is immediately returned to the caller, see lines 1157–1163 in the updated code:
>>                         if (hIcon <= 0) {
>>                             if (isDirectory()) {
>>                                 return getShell32Icon(FOLDER_ICON_ID, size);
>>                             } else {
>>                                 return getShell32Icon(FILE_ICON_ID, size);
>>                             }
>>                         }
>> It's not wrapped into multi-resolution icon when called from `Win32ShellFolder2.get()` for keys `shell32Icon *` and `shell32LargeIcon *` (lines 411/413–414).
>> Neither is the returned value of `Win32ShellFolder2.getSystemIcon` wrapped; it's also called from `Win32ShellFolder2.get()` when getting icons for `optionPaneIcon *` (lines 405/407). These icons are supposed to be large 32×32 icons, thus if the size of the icon in `getSystemIcon(SystemIcon iconType)` differs from 32, it should be wrapped. Otherwise, it could cause regression for [JDK-8151385](https://bugs.openjdk.java.net/browse/JDK-8151385): _[hidpi] JOptionPane-Icons only partially visible when using Windows 10 L&F_.
> I see - but still it has to be solved in the getShell32Icon method - which i'm going to do in a moment.

`Win32ShellFolder2.getSystemIcon` is still affected, the return value should be wrapped into MR-icon if its size is not equal to `LARGE_ICON_SIZE`.

    static Image getSystemIcon(SystemIcon iconType) {
        long hIcon = getSystemIcon(iconType.getIconID());
        Image icon = makeIcon(hIcon);
        if (LARGE_ICON_SIZE != icon.getWidth(null)) {
            icon = new MultiResolutionIconImage(size, icon);
        return icon;


PR: https://git.openjdk.java.net/jdk/pull/2875

More information about the awt-dev mailing list